04-01-2011 04:21 PM
Hi all,
I want to continuously move text in a string control like this during my entire program execution
"This is a text box."
"his is a text box T"
"is is a text box Th"
"s is a text box Thi"
" is a text box This"
" s a text box This i"
" a text box This is "
I think timer will also be used to make the moving text visible. Can anyone show me how to do this?
Any help will be greatly appreciated.
Regards,
mhs100
Solved! Go to Solution.
04-01-2011 05:52 PM - edited 04-01-2011 05:54 PM
The idea of the timer is good for this; to rotate text you can use something along this line in the timer callback (not tested: I haven't CVI installed on this machine):
char ch, string[512];
GetCtrlVal (panelH, controlID, string);
ch = string[0];
StringCopyMax (string, string + 1, strlen (string) - 1);
string[strlen (string) - 2] = ch;
SetCtrlVal (panelH, controlID, string);
I am using StringCopyMax because it is tolerant of overlaps on source and target string so I have no need to use an intermediate string to manipulate the text.
04-04-2011 11:01 AM
Check out the example program in samples\apps\marquee.
It uses a child panel with a text message control and moves the text message control to the left on EVENT_IDLE. Instead of using EVENT_IDLE, you can use a timer control.
Hope this helps.
- jared