Page 1 of 1

MsgBox for status information

Posted: Sat Mar 27, 2010 4:29 pm
by Susan Smith
I bet this is a long shot...

I'm updating some very old progams. Is there a way to use MSGBOX to display a message on the screen while a process is going on without stopping execution of the program to wait for a mouse click on a button?

I'd like to display a msgbox while I'm sorting a long file that says something like "Processing...please wait" or something more informative so the user doesn't see a blank screen and wonder if it has hung. I'd love to use a progress meter but I can't update it during the sort process. Currently, I'm just printing the message text to the screen without any borders, which doesn't look all that pretty. I could display a child WINDOW with the message in it. Is that a better idea?

-- Susan

Posted: Sat Mar 27, 2010 6:12 pm
by gtisdale
The standard msgbox will interrupt the program while it is displayed.

You can launch a NOPARENT window with the message in it and then close the window when done.

Or, you could possible use AUTOIT to launch a message box and then kill itself when a new title appeared

Or you could spawn another session that displayed the message

Of the above options I believe the NOPARENT window would be the easiest to manage and yeild the most efficient results. Set it as a function that returns the number of the window as the value of the function. When your routine finishes then close that window


01010 let waitwin=fnwait("Please wait - processing")
01020
01900
01910 close #waitwin: !:waitwin=0


def library fnwaitwin(message$*1000)
library env$("PD")&"vol002\fnsnap.dll":fngethandle
open #(waitwin:=fngethandle):"srow=2,scol=2,rows=3,cols="str$(min(70,len(message$))),display,outin
print #waitwin, fields "2,&str$(min(70,len(message$))/2)&",cc ,N/W:T":message$
fnend

Or something like that.

FNGeorge

Posted: Sat Mar 27, 2010 6:30 pm
by gtisdale
A few syntax errors in the above example. Use the attached.

Of course you must have FNSNAP.dll installed.

Posted: Sat Mar 27, 2010 10:44 pm
by Susan Smith
Thanks George. I hadn't thought of using NO PARENT. In fact, this is one BR 4.2 feature that I haven't tried out at all yet. Is there a benefit to using this method over just opening a regular child window and displaying a message in it?

-- Susan

Posted: Sat Mar 27, 2010 11:20 pm
by Gabriel
The benefit of using NOPARENT is that it opens a completly seperate moveable window, so you can make it look just like a real message box.

Gabriel

Posted: Sat Mar 27, 2010 11:27 pm
by Susan Smith
Oh of course. I forgot that MSGBOX is movable. Thanks. That's the part I was missing.

-- Susan

Posted: Sun Mar 28, 2010 10:30 am
by bluesfannoz
I had an example of a Progress bar using an No-Parent window at the last conference. I will also be talking further about using the No-Parent windows for Message boxes at the upcoming conference.

Steve

Posted: Sun Mar 28, 2010 11:38 am
by Susan Smith
That's wonderful Steve. I look forward to it.

-- Susan