News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Simple Marquee Text

Started by m-tek, October 13, 2007, 06:43:54 PM

Previous topic - Next topic

m-tek

Ok ive got some code that displays a marquee type text in text box


<DATA> TEXT dd 0
<CODE> .IF TEXT == 6
<CODE>      MOV TEXT, 7
Func GameStatus.SetText 'WELCOME'
<CODE> .ELSEIF TEXT == 5
<CODE>      MOV TEXT, 6
Func GameStatus.SetText 'WELCOM'
<CODE> .ELSEIF TEXT == 4
<CODE>      MOV TEXT, 5
Func GameStatus.SetText 'WELCO'
<CODE> .ELSEIF TEXT == 3
<CODE>      MOV TEXT, 4
Func GameStatus.SetText 'WELC'
<CODE> .ELSEIF TEXT == 2
<CODE>      MOV TEXT, 3
Func GameStatus.SetText 'WEL'
<CODE> .ELSEIF TEXT == 1
<CODE>      MOV TEXT, 2
Func GameStatus.SetText 'WE'
<CODE> .ELSEIF TEXT == 0
<CODE>      MOV TEXT, 1
Func GameStatus.SetText 'W'
<CODE> .endif


Is there a single line command instead of this long winded way

cheers

MichaelW

I assume that by "text box" you mean an edit control. I know of no single-line command that will do this in an edit control. If I were doing this I think I would use SetWindowText, or in a dialog SetDlgItemText, to update the edit control, and do the update in response to a WM_TIMER notification from a timer set up with SetTimer. The marquee effect would be achieved by varying the starting point in the message string. The message string would be defined something like this:

mymsg db "         welcome",0

With the number of leading spaces slightly more than the character width of the edit control. The starting point could be stored in a dword variable, with the value effectively the offset, in characters, from the start of the string to the first character to display. The value of the variable would start at zero, be incremented each time the timer fired, and be reset to zero whenever it reached the end of the string. The value passed to SetDlgItemText in the lpString parameter would be the offset address of the message string plus the value of the variable. Using a fixed-pitch font would make it easier to determine the character width of the edit control, and improve the appearance by eliminating variations in the apparent scroll rate.
eschew obfuscation

m-tek

Thanks for the prompt reply ....some things to look at there

BTW Im using a timer to control it at the minute

TY