HISE Logo Forum
    • Categories
    • Register
    • Login

    Script viewport position

    Scheduled Pinned Locked Moved Feature Requests
    scriptviewportscrolllist
    10 Posts 4 Posters 739 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.
    • d.healeyD
      d.healey
      last edited by

      I believe this was already asked somewhere but I couldn't find it.

      Is there a way to script the vertical or horizontal scrolling of a viewport?

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

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @d.healey
        last edited by ustk

        @d-healey Nope you can't... I tried to implement it myself but the viewport is a very strange beast in Hise, and I don't see the relation to Juce and where/how to modify the existing behaviour (or add methods)

        Can't help pressing F5 in the forum...

        1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart
          last edited by

          I've added a viewPositionX and viewPositionY property to the viewport, so you can set it using the usual methods.

          However it's unidirectional though, so scrolling the viewport with the scrollbar will not change this property (adding this is a bit more complicated, but let me know if you require this).

          d.healeyD 2 Replies Last reply Reply Quote 3
          • d.healeyD
            d.healey @Christoph Hart
            last edited by

            @Christoph-Hart Thank you, I'll play around with it this afternoon.

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

            1 Reply Last reply Reply Quote 0
            • ustkU
              ustk
              last edited by

              I needed this to be unidirectional for now so all good. Because when you add child panels to a list, sometimes (although not always) the viewport was following the incrementing list which is rarely the behavior you want. So setting it back to 0 pos when reconstructing the list is cool. I was using a trick for this before having a method.

              Can't help pressing F5 in the forum...

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

                @Christoph-Hart Yep this works perfectly!

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

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

                  Can we get bidirectional support for this? I have a list with a lot of items (child panels) and I'm wondering if I can use the viewport position Y to dynamically add/remove content as the list is scrolled.

                  I tried with a broadcaster but it doesn't appear to work.

                  HiseSnippet 954.3ocsV0saaaCElxIpqQasncnO.B5J2gfTKO2DuETT233rYr5Ti4rrNLTTvRRYQDIRAJ5jZTz1a66Ueg1av1g5GaoDizTCLegg442uC424b7XkjvRSkJjkyIySXHquydxbgNreHlKPCODYcW6Q3TMS4lK5f4I3zTFEYYswuXDXs0lnrO+ySO.GgED1RQHzoRNg8bdLWuT53d+FOJ5HLkcBOth0c5MjHE8kQxY.d1vtEJASNCOkcL1XVCazuhSCQV+fM0uiePWBd2t9cZSHs6tW6eZOBCGDv10+w60oaPm.LoUaj0sFP4ZoZhFqYoPPOPRmOITdgHOAmxS4uIhYN3il.YNWLpeHOhNt7xIEgr1b7xqpMxupdf8HNkuP9xqr6kovcoGUuzrZbcPx+q.RVUfzl4P591SHJdhdoFCd9V6gB3EDtRX0fRtsnF62vtuDrPn2IFeF6HEbXgGM2sUqscgud39NNO5QtGnjXJImRPYAbAWykBG3kKU6dNV4lRTxnn+DqIgfIOwcfXJWv1gnXPAWw6luyiS89YWuZN3ssqGVMMET72dDYbhT.3xHMQISXJ8byuOGGMi48p2WfIrViIgtZoK6bvZWykgSsvtStImH6WFxw4giyRa5cJmcQhTo8yhMbXrLMqr9Ki.u5YIfqfJMhC0ffotbZnzmWnoIbs4MhowPLBlIHl30bQEssaY8rsaV07Pm24rE7LjJiX6jn3Bcyb466.kYY.bkhikZ1KDMyr248NtWVUPvJ0YdgMHE.1pTaZEUWmiMEyheCSUEsFCApWc97stY7YRNgqhgRwPfK8hDVw4ijQTCO076qx9QELVSePABAS0YcAeeQW.iV9vh3TSavh2YTVQTcPE5OFdHViKCWMBBH6P14vfr7lrsrOjkdlVljYaw6IT323j+1kIdXu4UObAmpCWHn2G6Ex3SC0UkTKmeSdNuSYaOVvhxR2cqJIKi1Vl.Lu7GWJSe3xY5SetWBVAIoR1pVCnqN7AF6Ioyhv55yBMaIJT.DpZCfLCYDPm17paQ9JFP15ZGPdSg38sGygt2UiwFq.i.I4+CLVrV4N1Cf8XD8R.to8Qubc2g7ER+uKmo4hoivZE2PRNdV7DX8KgAYW.TmTCeogocK+bqR9yDlflc3egOEJ8MmsJT5WpDEigQjulj2jZVbc6LI.lDYK12B9GFvY2UzUFC6QeMgTOTWww1qqi+355Xm00wGutNt6553dqqic+xNZ9aNOalVFm21fPiFOHaJpk0.AFXfYrUz+gw.sdf
                  
                  // Broadcaster definition
                  const var scrollWatcher = Engine.createBroadcaster({"id": "scrollWatcher", "args": ["component", "property", "value"]});
                  
                  // attach to event Type
                  scrollWatcher.attachToComponentProperties("Viewport1", "viewPositionY", "");
                  
                  // attach first listener
                  scrollWatcher.addListener(0, "Meta", function(component, property, value)
                  {
                  	Console.print(value); // Gives weird results.
                  });
                  

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

                  ulrikU 2 Replies Last reply Reply Quote 0
                  • ulrikU
                    ulrik @d.healey
                    last edited by

                    @d-healey That's strange, it should work, but maybe you need to use mouse callback instead?
                    I had an old version to monitor the viewPositions, using the panels hover event to get the positions
                    Maybe you could have some use of it

                    HiseSnippet 1105.3ocsV81aaTCF2WaOfbvlXH9.Xcu5JppKoj0VXZhrllBQrzEQJElpplb84jypWrO4yoknoBukuW7EhuAvisujbWV5XJhkWT0m++64283G69JIkkmKUHufyllwPdel+foBcR6DBWf5dLx6g98H4ZlB6TczzLRdNKF44s42aT3UaKj82e+cGQRIBJagJD5bImxdAeLWuPa+V+HOM8DRL6L93Rd2rUWpTzVlJm.3YS+5nLB8ZxH1oDiaa3i9ARdBx6q7iazrwvCoj8OrQy8nz8N7f89lCnLxvgr8a7jCZd3vlCIz56g79nNwbsTMPSzrbj2VGIimNHQdqvUfy447qRYFgFnAPkcpOQlFaZQiVT6DdZb+YDUNBxR+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DncZE8uZ1egZC
                    

                    Hise Develop branch
                    MacOs 15.3.1, Xcode 16.2
                    http://musikboden.se

                    1 Reply Last reply Reply Quote 0
                    • ulrikU
                      ulrik @d.healey
                      last edited by

                      @d-healey I made it messy, you only need this:

                      const getViewposY = Engine.createBroadcaster({
                        "id": "getViewposY",
                        "args": ["component", "event"],
                        "tags": []
                      });
                      
                      getViewposY.attachToComponentMouseEvents([Content.getComponent("Viewport1")], "All Callbacks", "");
                      
                      getViewposY.addListener([viewPositionY], "something", function(component, event)
                      {
                      	if (event.hover)
                      	{
                      		Console.print(component.get("viewPositionY"));
                      	}
                      });
                      

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

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

                        @ulrik Oh that's a cool solution, thanks!

                        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

                        11

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.5k

                        Posts