LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing TEXT in the TEXTBOX

Hi,
 
I wanted to replace text with another text in the TEXTBOX.
 
I tried to override a text in  a TEXBOX, it always appends the new text to the old text. Then I used ResetTextBox(msg2) , but it didn't display  msg2, then I used SetCtrlVal(msg3). This is what happened, the old message is replaced msg2 and attached to it msg3. Finally, what I did, I set the argument of RestTextBox as null, then SetCtrlVal() overrided the text message that has been previously set by SetCtrlVal().
 
Example
SetCtrlVal(panel, control,message1);
ResetTextBox(panel,control,"");
SetCtrlVal(panel, control,message2);
This is the way I got message2 to override message1. Is this the correct way? or there is another way?
0 Kudos
Message 1 of 7
(4,838 Views)
ResetTextBox should do everything you want.  Just call it once with the text that you want to appear in the textbox.  If that does not work as expected, you may have some other peculiarity in your program.  Do you have a callback installed on your textbox?  If so, what does that callback code look like?

Mert A.
National Instruments
0 Kudos
Message 2 of 7
(4,838 Views)

Thanks Mert A.,

I did not use a callback for the textbox. Why the function ResetTextBox() doesn't display the message, I have to call SeCtlrVal()  after RestTextBox() to display the message.

0 Kudos
Message 3 of 7
(4,769 Views)
Take a look at the simple program I've attached.  All it does is programmatically create a panel with a textbox and a button.  When the button is pressed, it calls ResetTextbox to change the text displayed in the text box.  Try to model your code after this, and if you still have problems, please post a simplified version of your code that has your problem.

Mert A.
National Instruments
0 Kudos
Message 4 of 7
(4,766 Views)

Hello,

 

I know this topic is old but my problem is the same, so I put my message here...

 

My test code is very simple:

 

SetCtrlVal(panelHandle, PANEL_TEXTBOX_ETAT," working...");

.....

ResetTextBox(panelHandle, PANEL_TEXTBOX_ETAT," finish");
Delay(2);
ResetTextBox(panelHandle, PANEL_TEXTBOX_ETAT," ");

 

The problem is the text box doesn't show "finish" but directly nothing.

What is wrong?

 

For information, the text box has no callback function...

 

Please, someone can help me?

 

 

0 Kudos
Message 5 of 7
(4,136 Views)

Hi,

 

while code is processed that does not call RunUserInterface or GetUserEvent, LabWindows/CVI does not update the user interface. You might want to try calling ProcessDrawEvents (); after your call to ResetTextBox...

0 Kudos
Message 6 of 7
(4,131 Views)

Thank you Wolfgang for your quickly response!

Effectively with the ProcessDrawEvents function, it runs like I wanted...

 

I'm a novice, thank you!

0 Kudos
Message 7 of 7
(4,128 Views)