Author Topic: Button Will Not Respond to Accelerator While GuiTextEditCtrl is Selected  (Read 4458 times)

I'm trying to make an undo button which always responds to the keybind "Ctrl + Z". The button works properly, but if at any point I select a textbox in the form (which happens, you know, regularly), then it stops responding to the keybind.

While it does still respond to being clicked, I want the keybind to work properly regardless of whether I have a textbox selected.


I have tried making the undo button the first responder, which failed to work, and I have also tried defining sinkAllKeyEvents = 0; for the textbox, which also failed to work.

Does anyone have an answer to this issue?

No, I've never devoted enough time to figure it out.

Bump - I would really appreciate it if someone could post a solution, or at the very least a workaround.

I really don't think anybody knows.

It sounds like the engine is hard coded to sink key events into selected text boxes, regardless of the sinkAllKeyEvents property. If this is the case, then there's really not much you can do at all.

In my experience, the only accelerator that will still work when you have a GuiTextEditCtrl selected is escape.

EDIT: Maybe you could make a GuiBitmapButtonCtrl with an invisible bitmap that has escape as it's accelerator. Then that button can call a function that deselects the GuiTextEditCtrl and sets the window's accelerator to escape and it's own accelerator to nothing. Then you'd also need to change the GuiBitmapButtonCtrl's accelerator to escape and the windows to nothing when the GuiTextEditCtrl is selected.
« Last Edit: September 11, 2014, 03:27:52 PM by jes00 »