From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add text at cursor-position

Solved!
Go to solution

Hello,

i have two string-controls with text inside.

I have also a button. Now i want to click with the mouse in stringcontrol_2 at a special position, then click the button and then the text from stringcontrol_1 should be inserted at the position in string_2 where i was with the cursor before. 

Is this possible?

Thx for any ideas

0 Kudos
Message 1 of 3
(2,829 Views)
Solution
Accepted by topic author OnlyOne

Hi OnlyOne,

you can use the keydown event of the string control. Inside of this event you can read the property "Text.selection". If you don't select a text range, then start and end are equal, but they show where the cursor was placed. You can store these values in a shift register to use them in the button "value change" event.

 

Mike

Message 2 of 3
(2,817 Views)

Hi MikeS81,

thanks for the fast help. I used the mouse-down-event because keydown is for keyboard.

But now it works great.

Message 3 of 3
(2,784 Views)