Catch Enter in strings

3 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 4 months ago
Joined: 2014-04-21 21:15
Catch Enter in strings

I am opening a window with a string gadget and OK and Cancel buttons. I use WMHI_VANILLAKEY to catch Enter (13) and Escape (27) keys to act as if the buttons were clicked.

The problem I have is when typing in string gadget and hit Enter it automatically closes the window at VANILLAKEY with Enter (13) key. How do I stop this?

I want:

type type type ENTER
deactivate string gadget
Enter (fake click on OK button)

I have been trying to catch it with a hook but can't quite get it to do want I want.

  1. LAYOUT_AddChild, ChildObjects[GAD_STRING]=StringObject,
  2. GA_ID, GAD_STRING,
  3. GA_RelVerify, TRUE,
  4. GA_TabCycle, TRUE,
  5. STRINGA_TextVal, "",
  6. STRINGA_WorkBuffer, GlobalStringBuffer,
  7. STRINGA_MaxChars, 128,
  8. STRINGA_MinVisible, 25,
  9. STRINGA_EditHook, catchEnterHook,
  10. TAG_DONE),

I have put GA_RelVerify to FALSE, also.

thomas
thomas's picture
Offline
Last seen: 2 months 7 hours ago
Joined: 2011-05-16 14:23
Catch the GADGETUP event from

Catch the GADGETUP event from the string gadget and ignore the following VANILLAKEY event.

mritter0
mritter0's picture
Offline
Last seen: 2 years 4 months ago
Joined: 2014-04-21 21:15
That's what I ended up doing.

That's what I ended up doing. But what was throwing me for a loop was I was not receiving GADGETUP signals from the string gadget. I had to add IDCMP_GADGETUP to the WA_IDCMP tag. I don't have to do that in the main window, but I did for this secondary window.

Thanks

Log in or register to post comments