HISE Logo Forum
    • Categories
    • Register
    • Login

    Single button that switches between multiple panels ?

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    18 Posts 4 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DalartD
      Dalart
      last edited by

      I need help understanding how to create a single button that switches between multiple panels with an indicator showing which panel is active.

      I seen the example @Christoph-Hart has provided in the Basic Synth Tutorial for switching panels, but each panel has its own button.

      Here is an example of what I would like to learn:
      BankButton.jpg

      If possible when it reaches panel D and the button is pressed again it goes back to panel A.

      At this time the led indicator is a single image with 2 frames, on & off.

      Hope I made sense =)
      Dalart

      1 Reply Last reply Reply Quote 0
      • Dominik MayerD
        Dominik Mayer
        last edited by

        Got this for you:

        Still a bit buggy, though. (onInit Button4 is activated somehow.. and still flips on/off when toggling)
        Anyone any ideas?

        const var RadioGroup = [Content.getComponent("Button1"),
                                Content.getComponent("Button2"),
                                Content.getComponent("Button3"),
                                Content.getComponent("Button4")];
        
        const var Next = Content.getComponent("Next");
        
        reg x = 0;  
        
        inline function onNextControl(component, value)
        {
            RadioGroup[x % 4].setValue(1);
            x += 1;   
        };
        
        Content.getComponent("Next").setControlCallback(onNextControl);
        
        HiseSnippet 924.3ocsV8uaSiDDdcZ1pKgqHP5d.VUIjRzUpbZSAjpPDZZKJBZIhvUg3GBs0dSypZuq050PhPHwyx8jcOB2avcy5eD6b3DZL5b9mL6Lee6mGOyr6PkzgEFJUHqFudV.CY8q3QyD5I8mP4BzfiQV2FeFMTyTjjkNZV.MLj4hrr13YlErZTGE+72O4HpGU3vxWBgtPxcXuf6y04qNr2y4ddmRcYul6WH5t8F3HE8kdxHPOafsQATmqoWwNmZBqFFYs4ItbsTMRS0rPHlijtyFMQ9YQR7WvC4W5wLFcPi.hRVF0eB2ycX16ZHBYUeX9a9FIu4+F9LtKe954Yf6D6fjinXNvp1hRp9BRpyxjzoROWCAKQdVEjW8D4cW7HGEOPm6wnsagGHfONioPZunrRhEU6Oqg6KgHD5c8oWyNUAFyQz5A116PNv1t8ga0z7CR+gZxmnJxqntb4yTxn.xiIuKihqX59R+.o.LZs8QQZsTzY616rUSxRdVEx8pLx8qLxta29CGt3q54roZ3krbTFmamjdTrqHSg.sOjPL1bgGWvHiiDNZtTPjBSvFZTRuVNYbrCrIdQr1a07KIRNO09toj6Q59gcCY5KLwzpiYmLwLk76OlzA1HXm9Z7tuJ4YHHce6S87tD5ZZsfZLzVTmRM6khVsa9klMZ90lj+qqwiK0WJYdLUotMMypUArkHx+RlJKgjEHTguXKzl2rVHmjLRg.khABt9kArT67lrNkzjgRSoP6FNUgPn53lsam1rkTzf3.IMvo06nX4CKroU1Tt0.9dYvwVqKz8qNztyE87g02D3ahMEQkf8OFbLUSMCpRShPhMfozby2OqiYeBl5mL1pA9XV30ZYPbVNsvE9+MHOOc9V9s21a1biduumZdKT1G20g48VFye6xeRl2eYL+Wi+IYtaAl6UjYz0qj45+nus4zhNnHs86g99yffSBktQdT8hGOZtGPpCngegygLm0HB45YEKeViyLsK8LyRamugx8t3gbsyjx0asRzKTk++sdSuAxV3SFOl4nyEac7ouopW2XMjxqjQZt3pynZEGJHvmG4OBtDlCCThPv7BMybpYpJRrsylAMhIbiM9G3I0YGisUpyNYNQ9TGk7iNICcL2w4WhWAzjH95cMf6YB1j4yWwX6csQ9vUu9niiIUbeP6kiYuJfY+JfoaEvbPEv7fJf4gU.yiVIFysdeZjV5mzl.KL7j3w9VVmHnPUVbEI5eQoi+i4
        
        1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey
          last edited by d.healey

          HiseSnippet 1045.3ocsVs0aaaCElx1JH1atXEX+.Hxv.rQtTqzjtAj0VOamrYrkTi4thATTTvHQaSDIRAJpzXTDf8Gd.6o8p2gTRVxopIwCY5E6y8O9Qd3gijBWZTjPhrp+54gTj0WZOdNWMq+LBiiFN.Y8H6SIQJpDmnp27PRTD0CYYU8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FgEvWpQGsrUpQmLin.hqT7d2jqf0usZSiF.SbyyJqCuuEjwKu4Ui6.3Aeu20USD6BHu7H1esi3oqcDGr1Qb3ZGwyV6H9t0Nhu+VhP+55eLVIBRZK.EiN1Lwyx5XNANUYNAh9WUW5WCA
          

          Edit: Looks like Dominik got there before me :p

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 1
          • DalartD
            Dalart
            last edited by

            @d-healey said in Single button that switches between multiple panels ?:

            HiseSnippet 1045.3ocsVs0aaaCElx1JH1atXEX+.Hxv.rQtTqzjtAj0VOamrYrkTi4thATTTvHQaSDIRAJpzXTDf8Gd.6o8p2gTRVxopIwCY5E6y8O9Qd3gijBWZTjPhrp+54gTj0WZOdNWMq+LBiiFN.Y8H6SIQJpDmnp27PRTD0CYYU8mzJrpWCY996W1i3S3tzbUHzaDLW5uxBXpbsi59KLe+SHdzWyBJ38AcG5J38E9hX.OUs6fBItWPlROincqhMxZii8XJgbrhnnQfO8DdyGOS7Adh+ugEwN2mpEbPigDknF0eFy2aT1ZMBgrpMJekWMYk+01mx7XK0my.ekw.NOhhbfUkUgTsUfjymCRmH78zI3y.OqBvqVB7dr8XWIKTkaQisuvdHG1blP.ZuHrR7EUAU0tu.7fq1KfbA8DIHrLhVOqSmcvG1oS6iZ1nYCf7iT3KIRbHgS8ivOG+12YrLQHwsXfryQXF9GvGB+r81swerYCL7k39aY657Nvmr5Mkp5KBBEbPn0Viz9r01LcotQL6EAzkNJovu0DheDs8QMtNwMc00HxMVJg7XxBTiccL3hw8YbJdRL2UwDbrf2KVoDbmrr4lAfcf0keLscyFoXlMA2xnB+bXYsbojYZk58BndsyPbQKkBc7SdxOy7n3PI8RlHNJIv7zeikxpkZaMV91zZsmOkOUMSmwSEWRwJAlSuRgYbO5U4I7NAlRFmfK84xD2MACb70Fdr7srTtbq16Eo0axUehu+4PWYqaR0580B6CmITzWwa0twGaTuw0ehkISJyTZp7oxxrpurPdKg0hGGbNUlsSm5Gz+rZC5F2uFT2DJofiB9PNS8pPZpbdKrSIsvnTNU2LmBPvUkoU9QosxILHhAIotcJchLnu3Unnee3.hhjkH8VrTDRkJld4XM.Nk4RStint8.ZzEJQHxxd4FInNorMytAQe.vT0MsM+2AcUdAYcmmKLn6GXdpYP5rdoEBMixlNSok5.RLEMH6155afPK5Xheo18Kp9xLZ1pJp.z17Nf19ODPaA5EkAsEncLpQqAU8zGDpZw2TJUsXmaiptKncvCCz9qxg1+baPy9dbtt.35U.b+IsKK5TQ.jGhDTaUA8oy9fIvBuXehZ0wx52ejZ.tIXk4e5Yb7HlZdw2mrFyp6T5r5Razumv8w1iXJ2Yki2JkfWng++a7l9xml1GOYB0UkC1Z1m7G+WelyZ.keSDqX7omRTRFb9v9r3fwvQNWJfDtdnl9PZEcGZhbGsrlYFS4dFgEvWpQGsrUpQmLin.hqT7d2jqf0usZSiF.SbyyJqCuuEjwKu4Ui6.3Aeu20USD6BHu7H1esi3oqcDGr1Qb3ZGwyV6H9t0Nhu+VhP+55eLVIBRZK.EiN1Lwyx5XNANUYNAh9WUW5WCA

            Thank you very much guys, I appreciate this a lot.
            Im just starting out coding and even simple things can be difficult at times.

            1 Reply Last reply Reply Quote 0
            • jssrecordingJ
              jssrecording
              last edited by

              Screen Shot 2019-05-09 at 8.54.51 AM.png

              Doing something similar myself. Here is my method.

              //All Select Instrument Button.
              
              inline function onplaySelectInstrControl(component, value)
              {
              
                  Console.print("Current select row is " + currentSelectRow);
                  
                  ++currentSelectRow
                  
                  if (currentSelectRow > 4){
                      
                      currentSelectRow = 1;
                  }
                  
                  if (currentSelectRow == 1){
                      
                          Content.setPropertiesFromJSON("selectInstImage", {"fileName": "{PROJECT_FOLDER}select1img.png"});
                          
                      } else if (currentSelectRow == 2){
                      
                          Content.setPropertiesFromJSON("selectInstImage", {"fileName": "{PROJECT_FOLDER}select2img.png"});
                      } else if (currentSelectRow == 3){
                      
                          Content.setPropertiesFromJSON("selectInstImage", {"fileName": "{PROJECT_FOLDER}select3img.png"});
                      } else if (currentSelectRow == 4){
                      
                          Content.setPropertiesFromJSON("selectInstImage", {"fileName": "{PROJECT_FOLDER}select4img.png"});
                      }
                  
              	
              };
              
              
              
              
              Content.getComponent("instrSelect").setControlCallback(onplaySelectInstrControl);
              
              1 Reply Last reply Reply Quote 0
              • jssrecordingJ
                jssrecording
                last edited by

                I made a better performance update I wanted to share with anyone who needs it. I used 1 image with 4 states. Then I'm scripting through the changes updating the offset.

                 ++currentSelectRow
                    
                    if (currentSelectRow > 4){
                        
                        currentSelectRow = 1;
                    }
                    
                    if (currentSelectRow == 1){
                        
                        Content.setPropertiesFromJSON("selectInstImage", {"offset": "0"});
                            
                    } else if (currentSelectRow == 2){
                        
                        Content.setPropertiesFromJSON("selectInstImage", {"offset": "150"});
                        
                    
                    } else if (currentSelectRow == 3){
                        
                        Content.setPropertiesFromJSON("selectInstImage", {"offset": "300"});
                    
                    } else if (currentSelectRow == 4){
                        
                        Content.setPropertiesFromJSON("selectInstImage", {"offset": "451"});
                    }
                    	
                };
                
                Content.getComponent("instrSelect").setControlCallback(onplaySelectInstrControl);
                
                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @jssrecording
                  last edited by

                  @jssrecording Might be able to switch your if block for a switch statement. Another option is to put your offsets in an array and use the currentSelectRow value as the index.

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 1
                  • jssrecordingJ
                    jssrecording
                    last edited by

                    Great Idea @d-healey!

                    1 Reply Last reply Reply Quote 0
                    • DalartD
                      Dalart
                      last edited by

                      Im using the code from d.healey here:

                      // Panel Switcher //

                      const var panels = [];

                      for (i = 1; i < 5; i++) {
                      panels[i-1] = Content.getComponent("Panel"+i);
                      panels[i-1].showControl(false);
                      }

                      var currentPanel = -1;

                      inline function onBankButtonControl(component, value)
                      {
                      if (value == 0) {
                      if (currentPanel > -1) panels[currentPanel].showControl(false); //Hide previous panel
                      currentPanel = (currentPanel + 1) % panels.length; //Move to next index
                      panels[currentPanel].showControl(true); //Show panel
                      }
                      };

                      Content.getComponent("BankButton").setControlCallback(onBankButtonControl);


                      is there a way to call more than 1 element in: "Content.getComponent("Panel"+i);" ?

                      For example if I had panels named "PanelA, PanelB, PanelC & PanelD" could I show all of these elements where it displays (Panel"+i) ?

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Dalart
                        last edited by

                        @Dalart Sure, just add an extra line for each one..... but.... that sounds like a bad idea to me. You see that loop isn't grabbing 1 element. It's grabbing 4, panel1, panel2, panel3, and panel4. So why not just rename your panels instead of A, B, C, D. Call them 1, 2, 3, 4. Using letters is generally not as useful because you can't iterate letters in a loop like you can with numbers.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        DalartD 2 Replies Last reply Reply Quote 0
                        • DalartD
                          Dalart @d.healey
                          last edited by

                          @d-healey thank you for your input, I will tinker with this and your suggestion and see what happens =). Thank you for your time.

                          1 Reply Last reply Reply Quote 0
                          • DalartD
                            Dalart @d.healey
                            last edited by

                            @d-healey Ive been tinkering around a little bit without success in showing multiple elements in that one component, could you please give me an example of using an extra line for each element ?

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @Dalart
                              last edited by

                              @Dalart Post a snippet because I'm not 100% sure what you're trying to do.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              DalartD 1 Reply Last reply Reply Quote 0
                              • DalartD
                                Dalart @d.healey
                                last edited by

                                @d-healey Ok here it is, might not be the best way to do what Im trying but my coding brain is in an infancy stage at the moment, Im trying my best to learn though.

                                HiseSnippet 1546.3oc0Z0saaaCElJIpM1aYscXWtKD51.rQZSrjcRaQWac8OY0XMoF0ccEnnnPQhNlnxjFRzownnX8oXXON6AX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x2HnKEwKppzh0qyBFbixETaA8dCkLh8nCyZm.TVOHraDcaz71P9QccU+uqCNYd.Q0mLePq5uEYSGLSvG8pO.hNZfvi23UGQgCidLlBWB.lVw2OyjZHJVYMAfU3r.1UTEu4Ee7opvMeRzWBwkpxCXCWDSV0GYx6HKxAQKUQzxc0zJwPZfHNUOyzKm59HmILCA1ed3L5SUwlI3TvbwENPXthoisLRKaop7GIAgrwTGG0Dm87f4gzVJZ+cfHZSAgYjGBq5+qHrpRkvpFivtbpuEiSDqP4ii+RDG1mONlwZfzTPHTaCYVoZJ39IUoZJ3F9hEuPsVZplFiYanKmrJCvmZBSMYlvzH90qTxEF+WgK1QpbgQRadNOtnpr3hbQ.6JUBHeUOVLaHmUNLxTkipR8dbl9cIdONSWdkizkgzTRUNpluLjaIyLjl54XKRSiKTB31Rk.xSMhlUuPIf6HUBHe0HpJmZDUyTMhZxsFwembMh+QB0HZIoZD0RaFxodpeIlhzJOEIZYbwx.5RkAxSUhVUuXY.o9jasxWYhZxoLQsTF74ujG+v98Qg8Ehg8CwB62xKA3sOYHy0ltLsUVQLVpo3MBITTpgPQoO.quniO8QmdU08I1icLowOUW9QYGNAhEOwiOkeDoXODch3Qc+Y4ndSKbulZWD0ZPx3ckDvK.7YGugGb9Fps62GZQmC10T26Ee9OkbvSIioH7Q6aRcQ7bwCFOrGqECqe6.SL+jO44dqve2iAiqDsMoGDa6OXJ6S3j57wJgSpGMIXnokK40VAu7R9QyutuDFlv9+BEJntOer1rW4IG2CQ1nWaYwIhaxPdxVXjYKplYKpkYK1IyVrals3VY1hauDK3+3Ld3XJYXv1Blfts8eWwJJswlrrJ+LPv+Bd65Gy.
                                

                                So to summarize what Im trying to do here in this snippet is have button 2 choose the panels and button 1 would choose the 1 of the 3 panels within that panel.

                                I have it partly working where I have "FaderChoiceA"+i, so I was trying to get the other options to show as well, "FaderChoiceB"+i, and so on. Probably just not building the idea right would be my guess.

                                Thank You for your time !

                                1 Reply Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey
                                  last edited by d.healey

                                  @Dalart

                                  I see. Panels inside panels. Well there are a few ways to do this. For me the most straightforward is to use a 2D array for the inner panels that use the outer panel as the first index and the inner panel as the second index. And I replaced A,B,C with 0,1,2 for the reasons I said before.

                                  HiseSnippet 1563.3oc0Z0saaaCElJMps1adscXO.DYX.1HsIVRNosn+L233rZrlTi5rtMDTzoHQGyTYRCIpzZTDf9ns2j8DLfd0tMiT+XSYqjZ6Hgk4aR3g7b3G+NGcNTTrsK0B44QcAJE1e3.DP4qU6Ljv50nmIl.ZsMP4FpaY5gs.aMbfomGxFnnbseRzoRgkAA+97OtkoiIwBMVD.7ZJ1B8BbeLarz10+YriyNl1n8w8kFcs5srnjFTGpOGHWSsJXfo06LOBsmoXXKoBTtdSaLi51gYxPd.kk2hZOrSO56Igi+0XO7gNHQCMPGtgBEuC0wVfXgTPidXG61wKXO.2JsGu7uV3x+6T2EaiGIeLMb6fNfi0PlOTV5hfmlL7pN6vSQBdKGBu6n1wxEOfMtGA19J0VDFxsqI2EHCqvwBV5uTUaP4ifvVqu46P63xaLRixaVs5cgaTsZkGUpXohbGgGCdhoKbfIA43AeB7f27HY4c49O2H4v0WWeanoqq4vRE6Rcgkw7NzdDDCeLbC9eVc0JvOVpHj+KzdGfum1a3iIFPGgXMn8GPI7FkWosXLqrJVfkIzYMONeJzxk5TtqoiGJDvhgEBoXSGf2.wB.cbHfNlCnZ7+HAnIzbsA9d8JmNtDwr7fAQL8JqVlO5JqdbkXPNgcN33yAsAC9zhmFpk.6quNr8y1q4Kfc90V6234MeEmOKUTPxV9tt7YNfO3KfpAKULwASPvt9DKFlRfTxV9LFknGOQVwH9tbOkiOpRohQqUbWX4.QvmvsVBJPzUho6oP95Kl5k6I0UEGxOGaifCbQmfo9dgJN17SrRRNUqB4yzODMWq4fHGw5Ir3tzSPPFERPefAwDazGFavuHvXt9g3R7DX3vCo9REOMfGS2GGwkqTYMOg7.a0vzw4PdtnxSR0gwdAdvFO+ksZzLo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3ny.Wf69Xa7asrDDw83HOcMzmaMLlaMpM2ZrwbqwlysF2et03AWfFhaCzy7Yz9gOVvEztYvGOPQoIwjGUEDAB9WPp7ZmD
                                  

                                  This will be buggy though because all the inner panels are sharing the same variable currentFader you'll need to modify this so each panel gets it's own variable. BTW a panel can have a value panel.setValue() so you could use this to store the currently selected fader for the panel rather than creating a separate variable. There are many ways to do this kind of thing.

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  DalartD 2 Replies Last reply Reply Quote 0
                                  • DalartD
                                    Dalart @d.healey
                                    last edited by

                                    @d-healey Thank You again, I think I might have figured this out with your help !

                                    1 Reply Last reply Reply Quote 0
                                    • DalartD
                                      Dalart @d.healey
                                      last edited by

                                      @d-healey said in Single button that switches between multiple panels ?:

                                      @Dalart

                                      I see. Panels inside panels. Well there are a few ways to do this. For me the most straightforward is to use a 2D array for the inner panels that use the outer panel as the first index and the inner panel as the second index. And I replaced A,B,C with 0,1,2 for the reasons I said before.

                                      HiseSnippet 1563.3oc0Z0saaaCElJMps1adscXO.DYX.1HsIVRNosn+L233rZrlTi5rtMDTzoHQGyTYRCIpzZTDf9ns2j8DLfd0tMiT+XSYqjZ6Hgk4aR3g7b3G+NGcNTTrsK0B44QcAJE1e3.DP4qU6Ljv50nmIl.ZsMP4FpaY5gs.aMbfomGxFnnbseRzoRgkAA+97OtkoiIwBMVD.7ZJ1B8BbeLarz10+YriyNl1n8w8kFcs5srnjFTGpOGHWSsJXfo06LOBsmoXXKoBTtdSaLi51gYxPd.kk2hZOrSO56Igi+0XO7gNHQCMPGtgBEuC0wVfXgTPidXG61wKXO.2JsGu7uV3x+6T2EaiGIeLMb6fNfi0PlOTV5hfmlL7pN6vSQBdKGBu6n1wxEOfMtGA19J0VDFxsqI2EHCqvwBV5uTUaP4ifvVqu46P63xaLRixaVs5cgaTsZkGUpXohbGgGCdhoKbfIA43AeB7f27HY4c49O2H4v0WWeanoqq4vR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Ualqb0hkzROeRZoOWIsLxzsvc12m5V3NKKRZomSIsLtzAW2OOCtzWjjV55WU4pGjqb0hjzR23pJW8vbkqVrjVF4SRKi4JoUsrMo0emdRq+ICRZYjSIsps.AWSc.L4Xzkwhj0xP+JKYkquVtwhj1xv3JKYkquxswhk2pV9j2p1LBlwmxmDL1RNy0qmDF+wTv3w0wd6R6ymJSWtlJKIO2pyvQDdNy8mPSY3o+V82VcWpsuiIK40HPb2Ih5.ymO4uWu3axS7vrgx2shb4tELqv8NpswLqdoi2kRAu.Pti2napQI0lc6hrXiA6xp67a4+0x.7JpOCSNZWSlKlGentme+N7ZfVHNRHhOMs3biVRbXzgsqFdNR.PGDwNnwY7eQcpIZqD0oVbmf9lVtz2ZEdZ1h6BxMCjvwDI3JwTPcWQa3ny.Wf69Xa7asrDDw83HOcMzmaMLlaMpM2ZrwbqwlysF2et03AWfFhaCzy7Yz9gOVvEztYvGOPQoIwjGUEDAB9WPp7ZmD
                                      

                                      This will be buggy though because all the inner panels are sharing the same variable currentFader you'll need to modify this so each panel gets it's own variable. BTW a panel can have a value panel.setValue() so you could use this to store the currently selected fader for the panel rather than creating a separate variable. There are many ways to do this kind of thing.

                                      How exactly would panel.setValue() be used in the example here ? I havent a clue.

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @Dalart
                                        last edited by

                                        @Dalart Well each parent panel is going to need it's own currentFader variable. So you could have currentFader1, currentFader2, etc. Or you could just use the parent panel's value instead. panels[0].setValue(), panels[1].setValue(), etc.

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post

                                        49

                                        Online

                                        1.7k

                                        Users

                                        11.7k

                                        Topics

                                        101.8k

                                        Posts