possibility to have two same installeventhandlers at same time?
Posted: Tue Feb 23, 2021 11:26 am
I am not needing this now, but I can see there can come a situation where I could need this.
What I was hoping to do was following:
I was hoping result to be that when I push a key down, it would have debugprinted both "test" and "test2", however, seems there can be only one "onekeydown" event at a time, and hence only "test2" was debugprinted.
Is there any other way to achieve this, except by coding it myself in way of that I refer onkeydown to go to a function which takes care that all my "onkeydown" events are being executed?
I mean, I could do something like:
to execute more than just one happening. But is there any Hollywood supported way?
For example it could be handy if each InstalEventHandler would return an ID, and then I could later on use to remove those InstallEventHandlers by using that ID, this way I could use for example:
to get both "test" and "test2" to be printed, and then at later point use:
and now it would debugprint only "test" anymore when pressing a key down.
What I was hoping to do was following:
Code: Select all
InstallEventHandler({onkeydown = Function() DebugPrint("test") EndFunction})
InstallEventHandler({onkeydown = Function() DebugPrint("test2") EndFunction})Is there any other way to achieve this, except by coding it myself in way of that I refer onkeydown to go to a function which takes care that all my "onkeydown" events are being executed?
I mean, I could do something like:
Code: Select all
InstallEventHandler({onkeydown = onkeydownfuncs
function onkeydownfuncs()
foreach(onkeydownfuncslist, function (id, func)
func()
endfunctionFor example it could be handy if each InstalEventHandler would return an ID, and then I could later on use to remove those InstallEventHandlers by using that ID, this way I could use for example:
Code: Select all
ID1 = InstallEventHandler({onkeydown = Function() DebugPrint("test") EndFunction})
ID2 = InstallEventHandler({onkeydown = Function() DebugPrint("test2") EndFunction})Code: Select all
RemoveEventHandler(ID2)