DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Enter key in SUD entry box

Spoiler
      I have an Entry box and an OK button in a DIAdem 11.1 SUD. I would like to terminate the entry in the entry box with the ENTER key, and this should trigger the Ok Button Click event. I tried looking for vbCrLf in the text entered in the EventChange code, but it does not seem to sense the ENTER key press and hence does not even enter the event handler subroutine. How do I make it sense the Enter key press in the Entry box? Please help.
Spoiler
Thanks in advance
0 Kudos
Message 1 of 4
(3,495 Views)

Hi BLV,

 

I usually use the "EventLostFocus" callback, which works well with the "Tab" key.  I poked around in the EditBox properties, though, and discovered that you can monitor the "CurrentLine" property in the "EventChange" callback:

Sub EditBox1_EventLostFocus(ByRef This) 'Created Event Handler
  Dialog.OK
End Sub

Sub EditBox1_EventChange(ByRef This) 'Created Event Handler
 IF EditBox1.CurrentLine > 1 THEN Dialog.OK
End Sub

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

Message 2 of 4
(3,491 Views)

Thank you, Brad for your quick response. I was able to get the Enter key to work as required, in the Edit box. But the only trade off to make it function, was that the height of the text box had to be increased to enable the cursor to move to the next line on hitting Enter key!! Otherwise, the Enter key press was not being recognized!!

0 Kudos
Message 3 of 4
(3,485 Views)

You can also use the IsKeyPressed function. I think it is new in DIAdem 2010.

 

Sub EditBox1_EventChange(ByRef This)
 If IsKeyPressed(&H0D) THEN Dialog.OK
End Sub

 

You will have the same problem if you have only one line, but you can change the property "VerticalScroll"  to 2 (Yes No Scrollbars)

0 Kudos
Message 4 of 4
(3,482 Views)