You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have to detect a native key press on each specific widget
Map the native keys that were pressed to the corresponding Iup keycodes. https://webserver2.tecgraf.puc-rio.br/iup/en/attrib/key.html
Also may need to set MODKEYSTATE to record whether modifier keys are being pressed (control, alt, shift, option)
Invoke the user's callback
Check the user's return value from the callback and do the proper thing
This code should eventually be factored in a common place, but right now, the easiest place to start is directly code in iupcocoa_tree.m. There is a method called
(void) keyDown:(NSEvent*)the_event
already there which captures all key presses when that tree instance in focus.
From there (2) you will need to find which keys are being pressed from the_event object. You will then map these to the Iup keycodes.
You invoke the user callback (3), following the usual Iup invoke callback conventions. This too should eventually be factored in a way we can call this for all widgets.
Then check the return value (4).
I think (but not completely sure):
In - (void) keyDown:(NSEvent*)the_event
If IUP_IGNORE:
return immediately to end the method and don't do anything.
if IUP_CONTINUE:
call
[super keyDown:the_event];
and return.
If IUP_DEFAULT:
return immediately to end the method and don't do anything.
(this is the same as IUP_IGNORE, which is why I'm not completely sure)
if IUP_CLOSE:
call
IupExitLoop();
and return immediately.
Iup has a key callback for most widgets called K_ANY and KEYPRESS_CB
https://webserver2.tecgraf.puc-rio.br/iup/en/call/iup_k_any.html
We have to detect a native key press on each specific widget
Map the native keys that were pressed to the corresponding Iup keycodes.
https://webserver2.tecgraf.puc-rio.br/iup/en/attrib/key.html
Also may need to set MODKEYSTATE to record whether modifier keys are being pressed (control, alt, shift, option)
Invoke the user's callback
Check the user's return value from the callback and do the proper thing
This code should eventually be factored in a common place, but right now, the easiest place to start is directly code in iupcocoa_tree.m. There is a method called
already there which captures all key presses when that tree instance in focus.
From there (2) you will need to find which keys are being pressed from the_event object. You will then map these to the Iup keycodes.
You invoke the user callback (3), following the usual Iup invoke callback conventions. This too should eventually be factored in a way we can call this for all widgets.
Then check the return value (4).
I think (but not completely sure):
In - (void) keyDown:(NSEvent*)the_event
If IUP_IGNORE:
return immediately to end the method and don't do anything.
if IUP_CONTINUE:
call
[super keyDown:the_event];
and return.
If IUP_DEFAULT:
return immediately to end the method and don't do anything.
(this is the same as IUP_IGNORE, which is why I'm not completely sure)
if IUP_CLOSE:
call
IupExitLoop();
and return immediately.
Some info on Cocoa key events
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html
The text was updated successfully, but these errors were encountered: