OK,
Shoot me down in flames, laugh behind my back, have a little snigger . . . but:
Is there a flag or variable to flash text on the screen? Or make it shimmer?
Or make it light up and fade, light up and fade?
You get the picture . . .
Brian
Hi Brian, this sample will flash text on the screen:
$include "stdafx.inc" ' or "windowssdk.inc"
WINDOW win
OPENWINDOW win,0,0,800,600,@NOCAPTION|@TOPMOST,0,"",&winhandler
SETFONT win, "Arial", 64, 400
WAITUNTIL win = 0
END
sub winhandler
select @MESSAGE
CASE @IDCREATE
SetWindowLong(win.hWnd, GWL_EXSTYLE, WS_EX_LAYERED)
' make white color transparent
SetLayeredWindowAttributes(win.hWnd, RGB(255,255,255), 0, LWA_COLORKEY)
CENTERWINDOW win
STARTTIMER win, 250, 10
CASE @IDCLOSEWINDOW
CLOSEWINDOW win
CASE @IDTIMER
if (@WPARAM == 10)
static int state, count
state = !state
if state then DisplayText() else ClearWindow()
if (++count > 20) then PostMessage(win.hWnd, WM_CLOSE, 0, 0)
endif
endselect
return 0
endsub
WINRECT g_TextRect
sub DisplayText
if (!g_TextRect.right)
int width,height
GETTEXTSIZE win, "Hello World", width,height
GetClientRect(win.hWnd, &g_TextRect)
g_TextRect.left = (g_TextRect.right - width) / 2
g_TextRect.top = (g_TextRect.bottom - height) / 2
g_TextRect.right = width
g_TextRect.bottom = height
endif
MOVE win, g_TextRect.left, g_TextRect.top
print win, "Hello World"
endsub
sub ClearWindow
RECT win, g_TextRect.left, g_TextRect.top, g_TextRect.right, g_TextRect.bottom, RGB(255,255,255), RGB(255,255,255)
endsub
Ha! Maybe it was not such a silly question, after all
Thanks, Sapero, will try that when I get home
Brian
Brian,
Here is another way.
uint flashcolor=rgb(255,255,255)
window w1
OPENWINDOW w1,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"Test Window",&main
STARTTIMER w1,500,1
WAITUNTIL w1=0
END
SUB main
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
CLOSEWINDOW w1
CASE @IDTIMER
SELECT @CODE
CASE 1
IF flashcolor=RGB(255,0,0)
flashcolor=RGB(255,255,255)
ELSE
flashcolor=rgb(255,0,0)
ENDIF
MOVE w1,20,20
FRONTPEN w1,flashcolor
PRINT w1,"This should flash"
ENDSELECT
ENDSELECT
return 0
ENDSUB
Later,
Clint
There are no such thing as a silly question Brian, only challenges!
Egil
MMMMMMMM - not what my wife tells me.
Oh wait - that was a stupid question.
Larry
There are only two ways to argue with your wife - and both of them don't work!
the only stupid question, is the question you do not ask!