Using sleep function with Panels

Posts: 8
Joined: 2014-03-28
Location: Canada

Hi everyone,

I'm writing a function to give the user a simple alert in my functions. I would use DoAlert for this but I don't want them to have to click anything. I'd like a message to popup on the screen, stay there for a couple of seconds and then be closed automatically. Right now I've come up with the code below but when I run it I don't get the behaviour I'm expecting. It seems to open the panel, run the sleep command, and then load the titlebox command. I start out with a blank panel for a second or two then the text briefly appears before the window is killed again. Should I be using a different function for this?

Function procComp(atext)
	String atext
	NewPanel /W=(911,369,1311,505)/N=Alert
	TitleBox title0,pos={105,54},size={181,21},title=atext,font="Arial",fSize=18,frame=0
	sleep/s 2
	KillWindow Alert

Thank you!

Posts: 1596
Joined: 2007-06-21
Location: United States

Add this before Sleep:


Posts: 8
Joined: 2014-03-28
Location: Canada

That works! Thank you!

Back to top