Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 21, 2019 3:45 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: A MsgBox Sort of Pause
PostPosted: Mon Jun 08, 2009 8:40 pm 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
I now know several ways to produce a pause of a definite length (a ticks loop, App.SleepCurrent Thread, and a Timer control). BUT now I need a different kind of "pause."

What I want is similar to a MsgBox saying "Click OK to proceed." In this case, the length of the pause is indefinite; the user determines the length. But I want to do it without using a MsgBox. How can that be done?

Right now I'm writing a game program where I want the user to have time to read what's on the screen; click, say, on a PushButton which says, "Press me to continue"; and then continue with the game when the PushButton is pushed.

I prefer NOT to use MsgBoxes when there is an alternative. Even the extra control you have through the MessageDialog doesn't quite do it. How else can I pause a program and have it resume when the user is ready to go on?

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: A MsgBox Sort of Pause
PostPosted: Mon Jun 08, 2009 10:40 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
What do you need that msgbox and MessageDialog don't give you? They are very flexible. If you really can't get what you want from those 2 classes, you can create a modal window that contains anything you want.

Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: A MsgBox Sort of Pause
PostPosted: Mon Jun 08, 2009 11:27 pm 
Offline

Joined: Tue Sep 09, 2008 1:43 am
Posts: 39
If the messageDialog doesn't work out for you, you could always try using a timer with a "state" variable. It's a bit more complex but would work well for games.
Here's an example I made:
http://buildeft2d.googlecode.com/files/ ... xample.rbp


Top
 Profile  
Reply with quote  
 Post subject: Re: A MsgBox Sort of Pause
PostPosted: Tue Jun 09, 2009 12:49 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Both of the preceding solutions work fine! Somehow I remembered that MessageDialog allowed you to control the placement of the MsgBox, but forgot that it could be shown as modal. (I don't know know why, but I had the incorrect impression that only a window could be modal.) The example using the timer works fine also.

My game program ("NimRow," taken from one of Martin Gardner's "Mathematical Recreations" column in Scientific American, is almost finished, thanks to all the help I've gotten here. There are four options: (1) computer vs. computer, (2) computer vs. human, and (4) human vs. human. It really is finished, except for switching from the normal MsgBox to modal MessageDialog (or appropriate code using a Timer control. Oh yes, the program doesn't really require it, but I'll probably also be adding a choice to "Play through to the bitter end."

Even now, it's really complete (except for directions), and playing against the computer can be a rather humbling experience. I'm feeling pretty good, because -- although I had only worked on it in Windows -- I put the NimRow.rbp plus the two .bmp files needed for the sprites on an USB flash drive and brought that over to a computer running Linux (Fedora 10, to be specific). Using the Linux version of REALbasic on that computer, I loaded and run the Checkers.rbp program, and I was pleasantly surprised to find that also in Linux everything (including the sprites) seems to work as it's supposed to work! (It looked a bit different -- Windows apparently puts a MsgBox at the center of the screen, whereas Linux puts a MsgBox at the center of the program Window -- but it all worked.)

In a few days, I hope to post a note in the "Off Topic" forum as to how people can get a copy of the source code (free, of course) if they are interested. Thanks again for all the help!

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: A MsgBox Sort of Pause
PostPosted: Tue Jun 09, 2009 1:16 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
barrytraver wrote:
I don't know know why, but I had the incorrect impression that only a window could be modal.

You are correct. Both MsgBox and MessageDialog are windows.

Tim


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group