LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_KEYPRESS Trigger.

I have a text string control that I use to enter text and then when I press the <Enter> the text is sent out an RS232 comm port.

Is there a way to sent each character immediately after it is entered into the text window instead of waiting for the <Enter> key?

 

I want to emulate an RS232 comm port.

 

For example if I enter abcdf\befg

it would do the following:

 

ComWrt (comPort, buf, 1); // Where buf = "a"; ComWrt (comPort, buf, 1); // Where buf = "b";

ComWrt (comPort, buf, 1); // Where buf = "c"; ComWrt (comPort, buf, 1); // Where buf = "d"; ComWrt (comPort, buf, 1); // Where buf = "f"; ComWrt (comPort, buf, 1); // Where buf = "\b"; ComWrt (comPort, buf, 1); // Where buf = "e"; ComWrt (comPort, buf, 1); // Where buf = "f";

ComWrt (comPort, buf, 1); // Where buf = "g";

 

When there is more than one character I might have to read the string  GetCtrlVal (gPanelHandle, PANEL_TX_STRING, buf) and only send the last one? 

 

Thanks for any help.

0 Kudos
Message 1 of 4
(2,955 Views)

This is more readable.

 

ComWrt (comPort, buf, 1); // Where buf = "a"

ComWrt (comPort, buf, 1); // Where buf = "b"  

ComWrt (comPort, buf, 1); // Where buf = "c"

ComWrt (comPort, buf, 1); // Where buf = "d"

ComWrt (comPort, buf, 1); // Where buf = "f"

ComWrt (comPort, buf, 1); // Where buf = "\b"

ComWrt (comPort, buf, 1); // Where buf = "e"

ComWrt (comPort, buf, 1); // Where buf = "f"

ComWrt (comPort, buf, 1); // Where buf = "g"

0 Kudos
Message 2 of 4
(2,954 Views)
it seems the message title contains the solution you are searching for: EVENT_KEYPRESS is triggered each time you press a key when a control has the focus. have you tried it ?
0 Kudos
Message 3 of 4
(2,942 Views)

Yes I am using it now. I just wanted to make sure that I was implementing this in the correct way. Sometimes the obvious isn't necessarily the most appropriate.

Confirmation always helps.

 

Thanks.

0 Kudos
Message 4 of 4
(2,938 Views)