LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you place a Key Focus at a specific position within a string?

Here's the short story. I want a user to be able to write hex (C2 C6 09 06 50)in a string without adding spaces or having to use caps. I want to programatically add spaces and force to all upper case accordingly based on the string value. Simliar to:

current string value = new string value

c = C
C2 = C2(no space added after)
C2c = C2 C
C2 C6 = C2 C6(no space added after)
and so on.

Here is what I am doing. I have the string to update as you type and an event structure triggered on the string value change. Read the string value, parse it out by characters, rebuild the string by adding spaces accordingly, force to all caps and rewrite the string value through a property node. The issue is when I get to the third character (C2c). This always updates properly but the cursor is still in the fourth position (C2 |C)and not the fifth position(C2 C|). So, when I type another character, it updates in the wrong position and not at the end. I guess what I am asking, is if you place the key focus by position in a string?
0 Kudos
Message 1 of 2
(2,614 Views)
Look at the property Node "Text.Selection.Start" and "Text.Selection.End". Setting them both the the same value will place the cursor on that position (at least if the control still has the key focus).

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 2
(2,612 Views)