LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have a Text control string box with some initial text. I would like to highlight old text with click of mouse and type in new data from keyboard

I have a text control string box with some initial text (says: Please enter Name). I would like the operator to click on the text control box and have it automatically highlight so that when new data is typed in the old erases (all at once) and the new data is now in the text box.
I tried using the "Text.Selection" property node and when I run it and put the mouse inside the text box the initial text is highlighted and if I press "delete" on the keyboard or if I start to type in new data the initial data does delete but once I start to type new characters they erase each other. For example if I want to type in “Willi
am” I type the “W” and then the “I” but the “I” erases the “W” and now I am only left with an “I” in the text box and so on. I appreciate any help
0 Kudos
Message 1 of 5
(2,853 Views)
> I tried using the "Text.Selection" property node and when I run it and
> put the mouse inside the text box the initial text is highlighted and
> if I press "delete" on the keyboard or if I start to type in new data
> the initial data does delete but once I start to type new characters


If the selection is being set while keys are being entered. The coming
key will replace the selected characters. So, I'd start with looking at
all of the property nodes that affect the selection and looking for ways
they can execute other than when the string is initially focused. If
need be, you might set a breakpoint on them or have them log activity to
a global.

Greg McKaskle
0 Kudos
Message 2 of 5
(2,853 Views)
It seems you are continuously setting the property node over and over again. This should only happen once if you mouse over it.

Create a property node for your text control with the following three items:
(1) KeyFocus (wire a "true" constant to it)
(2) Text.SelStart (Wire a "zero" constant to it)
(3) Text.SelEnd (Wire a constant containing the string length of the text).

Put this property node inside an event structure, triggered by "Mouse enter" on the string control.

(see if the attached example works for you)
Message 3 of 5
(2,853 Views)
Sorry, the VI I posted above is broken under LabVIEW 6.1 because "mouse over" events are not supported there.

(While I have created it in LV7, it was saved under LV6.1. Interestingly, it works fine if the 6.1 version is loaded in LV7, but it is broken if loaded in LV6.1.)

Please find attached a LV7 version that seems to work OK. Sorry about that.

Under LV6.1 you probably need to jump through a few more hoops to get this working.
0 Kudos
Message 4 of 5
(2,853 Views)
I tried it and it worked exactly how I intended it it to.

Thanks for your help I really appreciate it!
0 Kudos
Message 5 of 5
(2,853 Views)