June 16, 2024, 02:56:15 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Silly question time!

Started by Brian, April 15, 2011, 03:21:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

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

sapero

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

Brian

Ha! Maybe it was not such a silly question, after all

Thanks, Sapero, will try that when I get home

Brian

ckoehn

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

Egil

There are no such thing as a silly question Brian, only challenges!

Egil
Support Amateur Radio  -  Have a ham  for dinner!

Rock Ridge Farm (Larry)

MMMMMMMM - not what my wife tells me.
Oh wait - that was a stupid question.

Larry


Brian


There are only two ways to argue with your wife - and both of them don't work!

Copex


the only stupid question, is the question you do not ask!
-
I really should learn how to use a spell checker! though im not sure how it will help someone who can not spell?
-
Except where otherwise noted, content Posted By Copex is
licensed under a Creative Commons Attribution 3.0 License

http://creativecommons.org/licenses/by/3.0/