KeyPressCallback
-
When I have a panel with a paint routine, mouse callback and a keypress callback assigned to the object, the paint routine and the mouse callback is visible as methods to the object but not the key press callback, is this intentional or is this a bug?
And is it possible to treat this 3 callbacks as methods for the object?
-
@ulrik What I'm trying to do is to set focus to an object from another object, and that works nicely if I just set "this" referencing to another object like this:
const PBRenameKPC = (function(obj) { var idx = Math.floor(AddDelRenamePnls.indexOf(this)/3); this = PBNamePnls[idx]; if(obj.isFocusChange) this.data.hasFocus = obj.hasFocus; else { switch (obj.keyCode) etc.....
but I also need to use the
event.result
from an object (that I can't set a keypresscallback on), to set focus on another object.
Is it possible? Any help is much appreciated.
-
(function(obj)
You don't need that
(
at the beginning.I don't think it's a good idea to reassing
this
. Use areg
variable outside of the function for that instead.set focus to an object from another object
What do you mean by
object
in this context? -
@d-healey said in KeyPressCallback:
(function(obj)
You don't need that
(
at the beginning.I don't think it's a good idea to reassing
this
. Use areg
variable outside of the function for that instead.set focus to an object from another object
What do you mean by
object
in this context?Ok, I didn't know that, thanks :)
the event.result come from a panel, that has several areas for setting values from 0 => 10 or more when using event.clicked , and I have it setup so that when using event.result I get one value from the hovered area, so event result inside area 4 will give the result of the area name which is also another panels id.
-
I think what we have here is an XY problem ;)
Start from the beginning and tell me what you want without telling me about what you've tried to do to achieve what you want :)
-
@d-healey with the event.result from one panel I want to set another panel in focus so it will receive keypresses
-
@ulrik Ah I see what you're doing. I think what we really need for this is a
Content.setFocus(componentId)
function or something similar. Everything else will be hacky. -
@d-healey agreed!