Pages: 1
Print
Author Topic: XFT: Capture ENTER-Key in text box  (Read 480 times)
spyro
Member

Posts: 35


« on: July 25, 2011, 03:30:29 AM »

Hi there,

is seems that there's no OnKeyDown- or OnKeyPress-Event for the text box control in a XFT-Form so one can run code after the user presses the enter key.

I tried to use the ActiveX 'Microsoft Forms 2.0 TextBox' instead (which has a event for that) but for some strange reason I am not able to change the text at runtime (the control is enabled and not locked).

So, is there any way to capture the enter key within a xmetal form and native controls?

Thank you,
spyro
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1546



WWW
« Reply #1 on: July 25, 2011, 11:37:20 AM »

Simple answer is no. Depending on what you need to do you could probably use OnChange to mimic OnKeyPress. What do you need to do?
Logged
spyro
Member

Posts: 35


« Reply #2 on: July 26, 2011, 02:21:52 AM »

Hello Derek,

is there anything you don't know about XMetaL? ;)

I made a sort of "quick navigation" where you enter a XPATH statement and then navigate trough the hits in the documents (this was also the reason for my question about non-modal dialogs).

It works so far but the user can't simply press enter instead of clicking a button each time.

spyro
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1546



WWW
« Reply #3 on: July 26, 2011, 01:08:55 PM »

You can set one button on your form to "fire" when the user presses Enter. You do this by setting the property for "default" to "yes".
Then the button should do whatever it is set to do (which you set with ButtonType property).

If you have more than one button with default set to "yes" then only one will "fire". However, you can also dynamically set this value, so perhaps if the user enters a particular EditBox you could set the corresponding button to have its default property set to "yes" and any others set to "no".
Logged
spyro
Member

Posts: 35


« Reply #4 on: July 27, 2011, 01:59:28 AM »

Hi Derek,

that sounds like a good idea. I will definitly give it a try today. Thank you (once more!)

spyro

EDIT: It worked! :)
« Last Edit: July 27, 2011, 07:15:22 AM by spyro » Logged
Pages: 1
Print
Jump to: