Rolling Display with Editbox
-
The short answer is: call SetWindowText for the edit box using a rolling buffer. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
What's a rolling display ? a marquee ? For an edit box, I would generate a string with appropriate spaces and "offset" with a timer control.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
I can make the text keep moving from right to left, but the text will stop at the end. Is it possible to make the text disappeared at the end of the display? How to do this? Please help!
Q&D: add spaces to the end of the text that will "push" the printable characters off the end of the control. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Q&D: add spaces to the end of the text that will "push" the printable characters off the end of the control. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Is it possible to make the text disappeared at the end of the display? How to do this? Please help!
A silly example:
// globals or class members, whatever you like...
TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
const int DISPLAYSIZE=10;and then
void RollText()
{
TCHAR szBuff[DISPLAYSIZE+1];
static int iStart = 0;
static int LEN = _tcslen(szText);szBuff[DISPLAYSIZE] = _T('\0');
int i;
for (i=0; i<DISPLAYSIZE; i++)
{
szBuff[i] = szText[(iStart+i) % LEN];
}SetDlgItemText(IDC_ROLLEDIT, szBuff);
iStart++;
iStart %= LEN;
}Each time is called,
RollText
roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
A silly example:
// globals or class members, whatever you like...
TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
const int DISPLAYSIZE=10;and then
void RollText()
{
TCHAR szBuff[DISPLAYSIZE+1];
static int iStart = 0;
static int LEN = _tcslen(szText);szBuff[DISPLAYSIZE] = _T('\0');
int i;
for (i=0; i<DISPLAYSIZE; i++)
{
szBuff[i] = szText[(iStart+i) % LEN];
}SetDlgItemText(IDC_ROLLEDIT, szBuff);
iStart++;
iStart %= LEN;
}Each time is called,
RollText
roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
A silly example:
// globals or class members, whatever you like...
TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
const int DISPLAYSIZE=10;and then
void RollText()
{
TCHAR szBuff[DISPLAYSIZE+1];
static int iStart = 0;
static int LEN = _tcslen(szText);szBuff[DISPLAYSIZE] = _T('\0');
int i;
for (i=0; i<DISPLAYSIZE; i++)
{
szBuff[i] = szText[(iStart+i) % LEN];
}SetDlgItemText(IDC_ROLLEDIT, szBuff);
iStart++;
iStart %= LEN;
}Each time is called,
RollText
roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeCPallini wrote:
you should code it better.
mmm, are you sure? :P
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
CPallini wrote:
you should code it better.
mmm, are you sure? :P
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Of course (but I'll bet no money)! :laugh:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkemodified on Wednesday, May 21, 2008 1:39 PM