Changing knob values with ScriptPanel position



  • I'm trying to change the values of two knobs from the xy position of a panel on the UI.
    Basically I'm trying to work out how to make a XY pad with panels.
    The values are changing, but are randomly jumping within a small range.

    HiseSnippet 1268.3ocuW8zaiSDEebR8xlrjxtHDGPHgUOfRQcCNY6tTI9mooIrQk1F1T5hPBsZp8jjQ0YFW6IsMrTIDRffabg6bBwW.tvI9NvMj3LW4a.7lw1wS9ylssRrN4fm268aleu2al27b6PtKIJhGhLJr+n.Bx34M6LhI5WuOlxPs1BYrr4N3HAIzJVzliBvQQDOjgQ9OTJvnvRH0y+79ah8wLWRlHD5.N0k7QzATQlz1NaS88ah8H6SGnY85Nsb4r5be9PfO4MsQAX2iv8H6hklkyDYbsFdTAOri.KHQHik1j6MpSe9orX6OfFQOzmHGTE0AlnXwM49dRFKkhp2m560N0uiPvrzNKJjONJ7Rl6P8nikmEMtoRgUFB83gQtEQupOc5YOO5YnQukho2sL63FRCDYZjb6FlsXPhpKFRA5zJ1VTNZdy5bvBlnx.7QjlgvfwHJeOa60rtqs8pucohkJBIhHg0I3PqsY7CqZ8tVoP6QD04CB3LXP4UTZWQhYRD0VHhZSgnMNDRwhP5wM9X4Zo1BJw0naWhK.ZBClALi3+jYXr5ovjD9VLRciVINrD+KVTkHhXG9vHRcru+gvN0xcGxbETNqL4DXBV8wkJZk7ndg10JVSEuPbOo5LCD8oQU7vBbky.9rCFb+PLqGIAvYVu4DbVxzGR8D8Ku5ZVPdqpjdyNWil2bMZNy08Izd8EyaxxdSkpkN8AX+gjx0rgm2Pi25nTI4La231k2PyzQqNssUq31WRQuxyNKYZTJNu34o4hz3sEmsKWP1iUd0hOtXghmWzZZUc6NWcxDeH22mDNW0x5SgKBXY1vAGRBWC1TA94XCgCpSVI3FWrJAtw6C0LjyZwnh8BHIi0Kkk50oZsQicVcQY9ntTkqMGyxDMaoHTx4DnnTtDyASEpRRKmTRpiO0iDhn.GeNSUpEohMxx7e92+m+3u7WeqC5BCtVFXt05v+WyA8Is1B1DIKLlPGfhAjPAUFnM1hbBbiSbYxBlaQhNRvCT1lbtFtDIdQKYpcJPslKqKoJ5rrqldUmQYCdGmSkG8PFlFuWNDpu5ribzuY.rJu1JU3oFaxVie+yzVie5zr03aP5qQMXz.bFru6ObFneK75NA3PXw0XwTtE5RPvZZD7qhzH3OnQvubgDDY4.sODzg9EvBYZZWoJ5xvvROoj00MyRSlF+JrPiju72vKiYVsYXFTpleZZAaX+xqXV2mBusl084m.M475VaA0l6QY8PA7fgA6wdfDtxH4co8gyeshlTlZNGCyvH2Sy+BROS0B7iWvbhK2jAG4HhR40LaFRNFZYZlV.fFQ3dC8whI6NQ1RVhBnP0DsAHupmEQEizaY6Rzxh8EtipKJcukYapvs+74at4vWYgm+m4aRCfkLia8HirKY17SeF2sWwzxX0GFdBowwJdL89EcJs6vAMo9vdmH49cnZDZSLyyNM.9ye8K6HETMQfyKt8CUBpMYW7Lu6Lsf0yDbSmlM2uACC9VbbH+jwg7Wr3vbRCOfOT.GgfNVBoxS0f6zA9V.WBjEXvIGkWkSdOT7Xa4XIk5PTdoow+BOIJqlFBjJqlp7YxZL.6Fxeja7kbxj50UR.+lo9RlBvmTAisFe0nrrnMZ.7kEOx0UtU61UQn4io1U.yctBXV+Jf4tWAL26Jf4stBX1XgXjeT2GLTvGDWFBDztgpKCCirc54P+G7rEUrI
    

    I'm aware of paint routines and how to generate a basic XY pad, which works great. But multiple script panels layered on top of each other cover the controls of the underlaying panels. I need multiple XY points on the whole UI.



  • @clumsybear Because what you want to read instead of the event.x/y is the panel's global position
    or if you want to use event.x/y you'll first need to memorize starting pos, as for a vector knob

    you can use a paint routine, but in one unique panel. As I told you by MP, I did this by the mean of moving panels, but now I would have done it with paintRoutine in one unique panel instead. But it's not that trivial. You'll have to create objects and memorize their position (among many other properties), so when you click on one of them you can iterate the object array to find out which one it is and update its properties.



  • @clumsybear you have set Panel1 to "allowCallbacks" and "allowDragging" which means that when you click and drag that panel, the mouse will not move relative to that panel, it will only move relative to your scriptPanel1, and that is not set to "allowCallbacks".
    I tried the other way around and set the scriptPanel1 to allowCallback and the panel1 not to..but as you say, the panel1 will interfere with the other panel so you will not receive any mouse movements if you drag panel1.
    I think you should set, with the paint routines, a dot or something, that will act as a visual reference for the dragging.



  • @clumsybear I forgot, event.x is the position of the mouse inside the panel you move, so it's fixed relative to that panel...



  • @ustk said in Changing knob values with ScriptPanel position:

    Because what you want to read instead of the event.x/y is the panel's global position

    I understand. The result is almost the same with getGlobalPositionX and getGlobalPositionY of the panel, but values of the knobs remain fixed at 20 and 8.

    HiseSnippet 1248.3ocuW07aaTDEeV6LkZCNzhPHAhCqxAjCJ0X6lVhDf5RbrasBIwsNjVfCgI6N1dT1clM6NNolnH93DG4ZukSbmibi+G3OA9GnG4F7lYW6csiyWVpc8EOuu1euOl26ssBD1zvPQ.xH21C7oHi2B2d.W1qVOBiiZtFxXd7FjPIMvLhzpC7IggTGjgQ1GpHXjaNj94kOXUhKgaSSHgP6HX1zuh4wjITaYsNy0sAwgtMyKkzKa0zVvqIbE8A7jEWF4Sr2mzktIQIVFLx3F0cXRQPaIQRCQFyspvYP6dhi3QxuCKjsmKUcnBpMXnHxMDtNJDqnhp0i45zZneGh.qzJIJjMJJ7t3MXNrQzShF2RyvLQizwCiLWD7pjFdku5vyHE7lKBd2F21Nf4KS3nv1ahaxgDUGBjBRCqHYQY9wr3ZBPBtrjGYeZi.3vHMJd+xkWx7dkKu3mUHeg7PhHTZdHIvbctXuJleg4PU6Rk0Dd9BNbn3BZtKnzYbMpdgZTcBMZQBfTrLfcP8GqdW5RPkd06zgZCJMl.mQYN087QXD6IzIN7cwZlVnEhBKQ+hHUJjJ2PzOjVi35tGToVrSetsjI3EoGBFXwiKj2L9Q+GVGyHNkbBHcUrSDP1iEVxgHIkdNfmMHf6GP3coEAH8PWwdD2VhPlx3Oy7SFC9JP+TlirWwEWxDRgUTH8rlcvkX1uYJl8QTV2dxoY2j+oK.TghcHt8oEqVFd93TdSZszo9DYW4NEWIknCVbRYqTxtmBsNEOqUR3nYbR9SFlgFlELE7MER5V7hKl+374xeRdyIY0oyT4oJGBDttzfoxV00J3hTrHuu2dzfkfRMvOGIHb8c79C3yu+P51W1QUmoDTvaxYxs7o7yqqAJtjF5ejIFUfnRc2i4i6dz1k4PCPLnIwaf0wajFvwcjO88+2+vBckUt5XJCOlVnut4ZPlU0CKFN.D8oARlx6MVidHLbHpiVN7Zzv8kBesrwWAASG8RKfSUZpemymlREzySdsen0fjCet0QpqFiH7xe1pmtndDkSO1Bt9JNZ3kX.Xe.tlKC92RlORbHL36iLWCtu1kw6BQgTfK2kFNSf0e8sof0oGMArN86mDVnlVdjD0+0+1xK8r1ks7IA.HRglIhHnqAPqlBn+TXJf9aSBTztWBPgrNrrfea1OLpL5Eu3Oev0AsENub9MwIYarw+.1df5OeG7mIPYyofxqQV1W322eK9STlPKjZJZOXJcyvwoosYRwgQlKyO8GdEsI3OuMdrwZv1N5STMyafaDPO.VV5LC+gUPDN8cIxw2KQsLVLCnYzXK.nFxyg17CRur1qjkUtpv813VLocuoi2LSAup9Xuhwa7peEvQKcj.14vMd1q487xOrqXs9AGRqefFGSVujFRa12qAyEpcTiULL.OaUB2o7v.3u+KumkhPkXBVuy5OUSn536uyct6jDVNgvsrZzX65bB3aQwgriGGxd0lmMkzvSD8kvUHXAk.l51M3NsguBvlBYANbyQ6UYTi0hNWVcVAo1TsWhM9O3IlYkgg.EyJCY9Z4c3QrCD6ZGMyTkTuolB32b82vjC9XJ3r4nIsXb4RkQdv2TrqsspT6NPswz0o5LnycmAcVdFz4dyfN2eFz4SmAcV4B0Q84beYeovKpMDPnUc8RKFFIU5YP+OvGqFwi
    

    @ustk said in Changing knob values with ScriptPanel position:

    I would have done it with paintRoutine in one unique panel instead.

    @ulrik said in Changing knob values with ScriptPanel position:

    you should set, with the paint routines, a dot or something, that will act as a visual reference for the dragging.

    If I could do it with paint routines, I would. But I know only how to realise one single dot on a single panel. Any pointers?


Log in to reply
 

5
Online

536
Users

2.0k
Topics

15.8k
Posts