Little help please: Make viewport scroll with keypress
-
I have a panel in a viewport. The panel displays a list. The items in the list can be clicked (mouse callback) to change the panel's value. The items can also be selected using the keyboard up/down arrows.
What I'm struggling with is updating the viewport's scroll y value by the correct amount when pressing a key selects an item beyond the top or bottom of the list.
I've included a regular viewport list in the snippet too so you can see what the default behavior is and that's what I'd like for my panel version.
HiseSnippet 1638.3ocsXstTaaDEVhfnwtMoMc5CvVO8GxAiiD2SHj.XfDOIj3ASIcFOLoKRqs1AYstRqg3lgN8AoOL80o+quAsm8htXvPHzo9GZuct7cN6YO6YcqXlGIIgEaXV5fQCHFlekU6QQ7fFAXZjQysMLuu0d3DNIFolZqQCvIIDeCSy67BwDlkl1P96ue9V3PbjGIeJCiCYTOxqo8o77Yaswqngg6h8IGP6Wf5E2noGKpAKjMDvycrbLFf8NA2i7FrfrorLLmYGeJmE2li4jDflsX9iZGvNKRQ+gzD5wgDw.Wi1ffTSazHfF52J0VSLLLmtUtkeGkk+cV6Q8oYym6A9F4BnbNJ5CLm55fj6mAjLK.ooUP5AVs8hoC34qHvyWZ0LB1P5hAWcQnnn0Xp+5tVMX.EQ758wmP1MFFjwg8xNN0PvmpqUtL3tS3n8e66d+K2o4Kd4An0QKr5ZEltcqMarCL6JYDGRgOqi5ToImzG4VoFR0a9rdKj0awrdKk0a4rdqj0a0rdONqmqSd2bs3lqF2b83lqH2kpbTFVOEGiNjRNa.Kl6BfN0qzivav5OfEACrqjQQkpqMAFm+Sx37UpNlJ06Y3HR3Uq0hDI3u3359XNtNErmDfegG+BqmP.IDPn8B3fkKHndHIpGO.8PjcgsyYy2Dqhlqv..uWTfsfvc99rgbZDwt6vHONkEY2qZ4OVtjvpv.T3AzDgc7ZlGNbK1vH+DaQfjjfXrOcXRAprqbLK1mDuubAgQVpbotrXjMEnxYMDE8TEw41q1Nf0lc1pkKA5NS4cf3V50Xf0xT76n97.aXhbJgfhRf1KQ6hrSI6Pb3PhcUz5qinftJUpmvOnx+XmaDBbolrRUgMThDlPtH4pl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rZQ4dASFiSMALJRS7+.F0ua8dV6zsKTsVN.m1Z2e519H0Og5UOPnGbqWLUbv6MC62FJSyi.ZOBNNlHNCJNioG6jdlrMIxWN3efe5EcSSeIVzMcQi9XHX+8dpThhWFeW4L.lhj+Q.kr1SLFkkH0xxotiQe3Q5u2ySX9yAIsmLOyeK3YgaAOKdK3YoaAOKeK3YkaAOqds7H9+Q1bHm0Wcb.ln0Nx6iLM2IBCQVxnPi+k8FBC2
-
@d-healey I can't yet load the snippet (I'm waiting for my console to print the 4000*128 lines I just asked by mistake... )
But I think it is the same thing I tried last week and end up letting go.
It wasn't quite simple to find a solution, but I can't sleep since I haven't resolved it :) -
@ustk It seems so simple to me, but I can't figure it out :p
-
@d-healey Yeah it seems at first :)
I got something but a bit glitchy, and that glitch caused more confusion than nothing so...(Please, Chris, add a compile panic button... )
-
@ustk Maybe it's easier to implement viewport LAF :)
-
@d-healey Yeah, but it wasn't possible in my case to use a viewport list.
That been said, you're probably right, if you don't need extended child panel capability you might want to consider staying in the viewport list realmTrying to have a look at it tonight...
-
@d-healey this is my go for it, but the scroll thing make my head hurt 🫣
HiseSnippet 1663.3ocsXstbaTCEd2jrkZCEnL7.H7.yrtwwc2buIDxEmj1Lso0SbHkY7jonrqrWMYsjQqbRMcBCOH7vviTeCfizd0NNkPf5er514x24niN5H2Tv8HQQbggYoiG1mXX9YVsFxjAMBvTlwA6ZX9IV93Kn9F6LrONJh3aXZN8SUKZVZFC8u2u4N3PLyijOkgwIbpG4EzdTY9rM254zvv8w9jio8JP8hacfGm0fGxG..YZKGi9XuywcIuDqHaJKCy6smOUxEsjXIIxvblc39CaEvujES+IzH5YgD0.WiVffhmdednuBwpYMZDPC8alZvQFfTZla9SGa9es0gTeZ174tguTu.Jmih9CyoFEdSOB7bKBOmBvaBPxr.jlIFROzpkmf1WluhBOep0ALIQzACt8hPIlViod+8sZvAJXx58vmS1W.Cx3vdYGmZH3S00KWFb8QRzQu50u4Y6cvSe1wnMPKr55EltUysarGL6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EHjyNfQkupOgcSUNZjbcNTv1TInBHUpKW6qRJWi3mVZfAT8LTuVVIFFZfWrXYi+0BY9wEx62z3GOXWHvQUDYB7.H2mHjTk2vbWxEPE4wkTVxZWRz4RdeM9SJGAJ0+VaAuMWw+vVCyGr6VWpt1Mah+TrUbEJYy7yAaA4tfs+cvhiCfnUF3TyEv2tkB8YH59wH5AVENzpAymWblQvigwvhCFEOnB34d+wTwjzGK.kUPqEsTHu.+xzrC.P+BqsCCQ4SXTfux25Muav+86+x+c+mNCgg4uYEWJ7CJGWYdR6BIsKlztTR6xIsqjztZR6SRZccR6jJQ2TQ5lJS2Tg5tjAjR8EPEoPb2TX0kq8zNn6YotwDdH30djC77Jt+fPrbz2bodnYxBPNfQdni5wLrHpbXwy.+u8PraKDenUS0EySFiSMALpRY7Q.iIOe8AV60oCTzVN.mwZ+e5iyaUMhemPW3ROAEBnsd4fdsfp07Hf1YvwRUNXS0YrjwNpwJOPKByWO3ufeIK5pFalrna5hF8vPv9a7hSOpdf780y.Xho+uAJYcnZLJKopkkScGidva0eimmx7mCRfOYdl+NvyB2AdV7NvyR2AdV9NvyJ2AdV8Cxi5uIY6ARdu3iCvDM2Seujo4dLLDYoiBM9a.xxVLO.
-
@ulrik What does yours do that's different to mine?
-
@d-healey your jumped 3 values for each cursor down or up, I guess you forgot the return true?
-
@ulrik Just moves one line here
-
@d-healey In the keypresscallback
-
@ulrik Yeah that's what I'm doing in my animation.
You can see in the code I only add one or subtract one, never three.
-
@d-healey Yeah, I know but...
HiseSnippet 1683.3ocsX0uTabCD+NfKM1sIsoSe.T8z+3bvXtiuSHD9vPR7jPhGLkzNdXRE2I6SCmkbuSFhaF5zGj9vzGo7FztRmtOLwjPoM7G9jVse7aWsZ0JZEw8Hww7HCyRGNZ.wv7qrZOhIBZDfoLil6ZXdWq8wwBRDJgzNiFfiiI9FllS+TIAyRyXn968atCNDy7H4jLLNhS8Huf1mJxo1ZqmSCCeB1mbHseAtWZqldbVCdHeHfmosbLFf8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FZbnnFmRMkeURlZIu.Huk3amd.Ap+FyCI0GDAE3Fi+KjEjle9R+LeHBpK0iKPBNJhHFFwPhngD4pElt9j2m2mOLl7o1joSNroqcdld+eerHnd2PNORuuLBMeVX3YpB9Pr79nhgbomfz+UtzGTfAknnjYalHYGk8NFN9Lm634XdgTuSI9IgZoFGOZeVZnKaohQacZUgsoHx.40JIqB6Fx3WZ.BwYujKHuhYqBRkunL5xK0s6DWSdiZDOLjDMwkkcXF8wDzFREOgDUKIrmwHz1038xYc08xUrUSujK3KvHm0jQEuZ.gcUMfZn6J.56aJMp.VEpt99VcWeD+zNLLn9x19x5TwPA7h8ba7uVIKbYk79MM9wl6BYNxdQ0vCf7.RjfJiFl6RNCZrOoyzRV6RhOUvGnvutqFCyu3Z6AuM2vOdqQ4S1cqyk2dmQ3uh1JoQmLJ+RvVPsJX6eGbzgAP5JCBp4J3G1Rh9LDc6DDcGqBmZUf4tEoLFdLLFUbx33AU.O25OmJgkA3HvXErZQOEJLvOOs7..zu1Z6vPTNAiBxU9Zu4cEwu+3W+uG+TkHLL+cqjNpuS4jF70eWT+cI82k0eWQ+cU820zeef9qqS5fTM5lpR2Tc5lpT2kMfZpu.ZrEx6lBKuituJ.cKK4Euv6I+f2JAuRi6OLDKF+oax2qpW.pAL16kjuIhESEiJdF3+s2yccg38rZQEdASFiSMALJKY7Y.i5WAeGq851E58KGfyX8je5yySdMRdtQO3VuHJjPa8xg8aCM84Q.qyfikxZvlxyX54Nx4xHPaByWM4ug+zK5JmapWzMcQi9XHY+MdIkGkuy91JJ.lXp+ECkr1WNGkUT0xxotiQe3I+uwyS59yAEvmrLKbCjYwafLKcCjY4afLqbCjY0afLq8QkQ9eaY6gBd+jiC.gV6otWxzbOFFxrTYgF+C.LVjD7
that's why I commented on it :)
-
@ulrik But it works in my snippet without returning true...
-
@d-healey ok
-
@ulrik I'll have a glass of whatever you're having
-
@d-healey You should always return true in a keyPressCB, Chris recommendations :)
Or troubles are knocking at the door... -
@ustk Aha well that's different, in that case I shall do it.
-
@d-healey Is there a particular reason you aren't actually using a child panel paradigm here? (even if not relevant to the problem described)
-
@d-healey the first and most simplistic way is this:
HiseSnippet 1741.3ocsXstTabCEdWfMM1sIsoSe.T8zerNXb7x8DBgKFRhm.AOXJoY7vjJ1U1qFVK4tqLD2LoSeP5CSee5exaP6QR6MC1ITZC+vqtbt7c9zQGIQyPtKIJhGZXV3ng8IFlekUqgLgeceLkYzXGCy6ZsONRPBQ5g1dXebTDwyvzb5mIGvrvLFp+9vFaiCvLWR1PFFGyotj8n8nhrQat4KnAAOE6QNh1KmzKtYCWNqNOfO.vyzV0L5icOC2k7RrTrorLLu0tdTAOrk.KHQFlyrM2aXKe9ELs7GSinmFPjcbLZAFRO7S4AdRDKG0ntOMvqYRbGY.VoYFKLslE9Nq8odzzwyXiuQMAJSi77g4TiBuoGAdN4gWsbvaLPxLGjlQCo6Y0xMj1WjMiDOeoUCFr3zACzddnnk0Xp+pfUcNHASTsG9LxSCgNoZXubsZUPvOkWqXQf5iDnCO3Uu44613YO+Hz5nEVcsbC2p4V02EFckTgCnvOqiZWpgfzC4TpBR2Z9zVKj1ZwzVKk1Z4zVqj1Z0zVOLskSsrlYdwIyMNY9wIyQNKU5jTrdNNDcLkbQednvA.cBqzkHpy60myfN1kRknT40Fihy+IUb9RkGwkwqYXFIXxdMuPR8y2upGVfqRg3IBzWx3WZ9HBXAeBsqu.hbo.UCHrtBez8Q14VNmMaQrLZtbcFAudzNcdtxXf2FwO.j0SXKUOknxONXoqfslvNGwg7ABJiX2Y.yUP4L6tkK9thEjNDC9Q3Sij1YOtKNXa9.lWjsLmTIPH1iNHJmT1kNkG5QBOTMgjuJTrPGdHxlBRUaMDE8XsvYTWLk.yM6rkKV.7cpyaCaAneDtpRpieE0S3aCCjIIjeU.7dAZGjchXGiCFP.RZ80QTvWEJzUxC5xZ1YAgDW5AKUVFCEHAQjKKt9ST0KnB+sB56iyYfS6lndkbgqO+bnVsz2nMPNUqgdDpV0k0dP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leOv+auA85Bw6Y0jJb8GOFmZLXTVx3y.Fie49cr1sSG3RlY.bFqm9Seddltg9cMcgyfCoPBs0KGzqEb6RWB3cFrsTVC1TtGKteMYeICzhv7Tc9a3u3Icj8MimzIYRidXHY+Mt5xix+2.2VMBfIl5eKRAq8k8QoEUsrpUslQOpG8MttxveNn.930Y9afNKbCzYwafNKcCzY4afNqbCzY0OpNx+CQaMPv6o2N.CzbW04Rll6xvPlkJKz3e.sU1ehB
Now the slowly shifting position isn't particularly nice visually speaking
It would be better if it can stick to the bottom when going down and oppositely when going up...