Return the old Content.setKeyPressCallback functionality (that we had for a few days)
-
@Christoph-Hart Btw, what is it checking against? For special keys like Backspace, it works if you type in
backspace
no matter the case, but BS, which is the character code in ASCII for backspace, does not work. -
@Christoph-Hart said in Return the old Content.setKeyPressCallback functionality (that we had for a few days):
The new way is now checking for keypress matches before calling into any script, then returns true if the registered keypress matches (all within C++) and kicks off the asynchronous script callback, which is much more stable.
But a catch-all string might work, but can you elaborate the use case you're after?
Ok this broke a lot in my projects, so it says
Does this mean I have to list every character I'm going to use in the specified keypress callback?
likeconst consumedKeys = [ "a", "b", "c", etc........];
It is a callback for user search presets
Or how do I setup a "catch-all" string? (I guess this string will cover all
-
@ulrik you can do pass in cosumedKeys = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
and follow up with any special keys you want to use
consumedKeys.concat("Escape", "Backspace", "Return", "Delete");
-
@aaronventure Or just use
setConsumedKeyPresses("all")
:)Throwing a compile error when you don't call this method is an entirely educational measure, but I think it's better if people run against a compile error that requires their attention instead of silently changing the behaviour (because here the implications are very subtle and not obvious).
-
@Christoph-Hart said in Return the old Content.setKeyPressCallback functionality (that we had for a few days):
@aaronventure Or just use
setConsumedKeyPresses("all")
:)this will throw an error
and the project will not compile -
@Christoph-Hart sorry, I opened it with an old compiled Hise app,
indeed it work, thank you @aaronventure and @Christoph-Hart ! -
-
@d-healey thanks David!
-
Just ran into this myself opening an old project.
I have a label. When the user types into the label I want to perform an action based on the text that is typed. If I use
setConsumedKeyPresses("all");
then the callback triggers but the text in the label doesn't change as the user types. Is this a bug or am I using it incorrectly?HiseSnippet 753.3ocsUstSaCCE1tzvnciogzd.h3WEIDpciwlzDZL5koJnPzJCs+gbSbZ7picjsCP0Duy6MX63jTZKTwkJsnpJeNemujubtEOkzmp0REBW4rwITD9UN8GKLQMiHLApaKD90N8HZCU4l65vwIDslFfv3U9l0AtRYT10e9xgDNQ3Sm5BgNWx7oGyhYlod8N3HFm2gDPOiEOSz6dPWeonojKSA8rhScTBweDYH8DhMrRNH7psCXFopugXnZHlCkAi6GIuRjG+4LMa.mZMZf5C2nb2nlQLdf2j2UMBgK6M8Mek72725ziEvt0+zLvax.bmxX1b.tzCIoFOCIgmQRkykzFN88UrDyTDqddoSWATPBIPpdVojGKpzwXmlRHBgYmXxHZGEXbKiZ6Uu91tvea84pUgzs13dIQ4dLY.k2vce2ILGRMMkwIRAXTayb3MsbxOti1hKzowzfini8Tf7n5ZaR376D0Dzl.z.ndVKLU3aXRQM4fesU0eWs5M.gINckhSjF5ohZVnJUuop6cgBCWHlU3JImSUKD11podHh0DowCnpsgzAOkdafPsX9B7pOsBreddbl.khtBl4zDZgcGIOvV3rmue6.pnP.m9Q2VDCw1gT3ChKgpLLqbvsnWBiX48KUbZQ0iLxjrXKpdH7KLYnqWzMkUaPL3QulSdcBcMB6fOBdVisG1GNbEKvDYM1FiPQT1vHi0xCfLzqM16lNHr3WHLTeulWXrQFjxIl4mkrKMJ.f7+bMv1lTglYFO6Rkmw.V8Gb.6oJwMb7XF+nEqwRKPiPk4+gFKVKstS6vPpuYp.K6z4mK6NnG4w+cYpgIF1iXTLaOwIow8gsw9T3oKDTt11CTx1claW2Zay.8ohfLi+BWEfMr13BvFS.QwDek7B+7oN6hu0x7.ZRjsmuB7AGv1sAJaRb17bLrG9Be+4uU2i36VVhueYIt6xR7CKKw8VVhebYI9oGmn8yjeM0HiyGaPnddsyVcgwsEDnCLqaE8OvbAXk9
-
@d-healey I opened your snippet and can type into the label. Click on label, type, works as expected.
macOS 14.4.1 9d0b36cc0e5c4dc9d5c5bc3f434323322fa13fe1
-
@aaronventure Time to fire up my Mac and see if it works there
-
@aaronventure said in Return the old Content.setKeyPressCallback functionality (that we had for a few days):
@d-healey I opened your snippet and can type into the label. Click on label, type, works as expected.
macOS 14.4.1 9d0b36cc0e5c4dc9d5c5bc3f434323322fa13fe1
Confirmed. Seems to be a Linux bug. I'll see if I can figure it out.
-
hmmm I can't see anything obvious and no errors reported in the debugger. @Christoph-Hart Any ideas?
-
@Christoph-Hart If I remove the
return true
from here it works - https://github.com/christophhart/HISE/commit/65ef5cbdb6b6a28210afd961fa8ebbf7e6a9f7e0#diff-0d582ddb8fc1bed436b29e85947f1c794dabe03de8eba02b4632e41563e4187dR1609But I'm guessing I shouldn't do that?
-
@Christoph-Hart Bump bump
-
@Christoph-Hart Still having this issue on Linux
-
@Christoph-Hart Seems this isn't just a Linux problem. Try this snippet on Windows
HiseSnippet 768.3ocsU01SaCCD1tsAQ6FSCo84oH9TQBgZ2XuHglVG8koJnP0JC08IjahaiGN1QIN.USHsex6e.6bbZS5nCXUZ4CU4tm6re5cO2k9gRGZTjLDgKe5z.JB+TqASEJuldDl.0sEB+LqdjHEMz135foAjnHpKBiK9YsCb4Rnjme8wCHbhvgl4BgNSxbnGw7YpLu8abHiy6Pbomx7yE8dM55HEMkbYLvmhV0PADmKHSnGSzgUvBgWqsKSICGnHJZDBW5.o6zAdxqDl3OiEwFwoZi5nAvAYb2Qxc0LV6E0ziwc6O6+cDBNk9YUghlpvKr5wbYy8mUMddBfcVF4qG3BKRuhKPu5+M5sDJgyQoRFJso0.mPVfJCQymmX0U.MmwDnrmmJlXQE5fsZJgHDpc8IWP6DBFyyn5aqUaGa3ms2uREnzGorOhLhxqa+A6YYMgpZJ8CjBvn5VF3sf3MusajFVDE6ScOjNseHvLZT0sHbtNnbQMCsI.MBZqUGGKbTLonpbz22txOpT4ls2elOao3XohdhnpFobkapX+mPiGuTLMsCkbNMbovZAW38kXUQr+HZ3N1WR3wz4ABcgEasq83ZsNlpXt.khtBl5j.Zp88qMQosA3su1sEQQzZiTePbAzPESSGbK5kvflQoT1pEM5BkLHI1zdGButJAciTcTRqAwfqdcKSaBcc1r32ZLctwOOqwULWkGBagCwHjGkMwSosdIfpnWqRFNGMY1na40FNb3slY86nigIHoaLmnVbrRuKIE.ZHKnk05UQDSMM+tl+gYsZ26r1ikhaZ0mob7VNGKrDNBsp+GbLcC0FVsGOl5nxHXIqNCW00QOv0+EYrhIlzinBYfHw53X+APm1gB2tPP4QZwPAsb0XWSaqq.CnB2DiagmTv5ZabJX8YfHehSn7bGyXndG35Id.NIRV+WF9NDXaWGkLZluN6CqjO2wYwi5NI9pUMwWupIt2pl3aV0De6pl36V0De+Cmn9KleJVI8MiMHTu9sS1kgwsEDPAlnVQ+Ff5Dq0.
I see the relevant HISE source code has changed since I initially reported this issue, so possibly the changes have made it broken for other OSs now :)
-
Can someone try the snippet above and confirm the issue? Thanks.
-
@d-healey Can you please sum up what am I supposed to be looking for?
The snippet behaves like the last one on macOS.
I'm seeing something else, though: if the script callback exists, then pressing enter will not defocus the label i.e. it won't return to its passive/not-editing state, but the Enter/Return callback trigger will definitely go through and send the appropriate obj in the callback.
-
@aaronventure said in Return the old Content.setKeyPressCallback functionality (that we had for a few days):
Can you please sum up what am I supposed to be looking for?
Typing in the box doesn't do anything.
I just tested on MacOS and it's working fine there, so the issue seems to only be on Windows and Linux.