LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert a word into a string of the text box control?

int text_pos;
 
GetCtrlAttribute (panel,TEXTBOX,ATTR_TEXT_SELECTION_START, &text_pos); //char loc 
.....
 
 
How do I insert a word or character into a line of the textbox ?
 
For Example: "This is a string"
After insert : This is a test string
 
Thanks in advance
HDN
0 Kudos
Message 1 of 4
(3,314 Views)

I don't know of a way of inserting some characters in the middle of a text directly within the text box control (I suppose you want to do it programmatically, not consideing the case that the usr directly types into the text box): you need to retrieve text box contents and create the new text in a string and ResetTextBox with this new string.

OK, maybe there can be another way by programmatically posting some keyboard events to the textbox via FakeKeystroke or some SDK PostMessage or someting like this: I never tried it so I cannot help you for this.

Message Edited by Roberto Bozzolo on 12-17-2005 08:32 AM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,303 Views)

OK it can be done with FakeKeystroke: look at the attached sample project.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,297 Views)

Hi,

Both examples you provided are great.

My application only require to insert few characters, therefore, I chose function FakeKeyStroke for my app.

 

Thank you , I'm appreciated for your response

 

 

0 Kudos
Message 4 of 4
(3,272 Views)