LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

numeric control highlighting

I am using a numeric control for entry of double values. I would like the control to highlight on a single left_click so that users can enter a value that will overwrite the default value. Currently, with left_click, the cursor is positioned after the current value so that any numbers typed in are appended.

From some tests I ran on the control, I can only get the highlight and overwrite to occur with a left_double_click. I tried to capture the left click event via a callback function and call the callback function again with left_double_click as the event, but this did not seem to work in forcing a highlight and overwrite. I also tried some variations of got_focus, and setactivectrl, but again I had no success with the single click highli
ght.

Is there any way to programmatically set the edit mode of a control so that data is entered as overwrite rather than append?

Is there any way of forcing a control's data to be highlighted, and then presumably set for overwrite?

Thanks for any insight into this matter.
0 Kudos
Message 1 of 4
(2,870 Views)
Hello Phil,

Setting the control to highlight all contents of a control is currently only achievable for text boxes and string controls. This can be done with the use of SetActiveCtrl() and two instances of SetCtrlAttribute() with the attributes Text Selection Start and Text Selection Length. This process is described in detail in the following KnowledgeBase (located on our website www.ni.com/support):

How Do I Set the Cursor Position or the Selection Length in a Text Box or String Control in LabWindows/CVI?
http://digital.ni.com/public.nsf/websearch/C7ED49C29AABA1D086256D1D00645C0F?OpenDocument

Another option could be to modify the CVI environment by using CTRL+INSERT to change the text selection mode of CVI. This process is explained in:

Text Select
ion Modes in LabWindows/CVI
http://digital.ni.com/public.nsf/websearch/76BAD0759E814ADF86256C52006EACF7?OpenDocument

One way around this for your numeric control might be to change it into a string control and then convert the string into a numeric format using commands like strtol or strtod.

Please let me know if you have any further questions on this issue. If you�d like, you can file a product suggestion for CVI at:

http://digital.ni.com/applications/psc.nsf/default?OpenForm&temp1=&node=

Scott Romine
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,870 Views)
Hi PhilD.

Try one of these:
1. Left-click on the numeric control's label.
2. Navigate to the numeric control using the Tab key.

Either way, the entire value will be highlighted, and can be overwritten on the first keypress.
0 Kudos
Message 3 of 4
(2,870 Views)
If worst comes to worst, install a popup to respond to EVENT_LEFT_MOUSE_CLICK, get the value, and overwrite the current number. But I would rather give up this funcitonality, as it would look more like a bug, not a feature. This is the PC plantform, not Mac. 🙂

lajos
0 Kudos
Message 4 of 4
(2,870 Views)