Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dumb Question # 4 - form flow control

Status
Not open for further replies.

FAC17

Programmer
Jan 24, 2002
26
0
0
US
Ha! You guys thought I had dried up and gone away. No such luck - sorry. I am back with more dumb questions...

I know I have read about this but can't find the thread...

I have 3 forms:

main - textual data input
subform1 - text message with continue button only
subform2 - text message with continue button only

User enters text data into main form field(s). Main form calls subform1 or subform2 for certain error conditions. If subform1 or subform2 is called I want the user to be able to read message, then click continue button and release that form. Also then the text input fields in main form should be cleared and the main form redisplayed.

I call subform1 on from within the main form in the click event of a buttton with:

do form subform1
read events

In the unload event in subform1 is:
clear events

How do I redisplay the main form?

I hope all that made sense!

Thanks for your help!
 
HI
If your intention is only to display an error message,
you dont have to craete another subform for that.
You can do as given below..

ClickEvent in Form1..
IF error condition..
MESSAGEBOX(myErrorNMessage,0+48,"Error Message!")
RETURN
ENDIF

This will do the job. Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Why are you using forms to display such messages? Just use a messagebox with your message and an ok button (look in the help for the various sorts of message boxes.) Being a window's standard, everyone will recognize and accept it.

But I think you're also confused about when to use the READ EVENTS / CLEAR EVENTS commands. They're only needed once in your whole program, whenever you want the program to start / stop listening to the outside world. You can put READ EVENTS in a 'Main' program or in the base form you start from, but you generally only put the CLEAR EVENTS in the last form which will be released, not in a subsidiary form, since that tells the program that everything is over and it's time to close up and go home. Assuming that you already had a READ EVENTS command in your main form, your subform is returning to the main form and doing whatever follows its READ EVENTS command, which might be something like 'thisform.release'. If you are closing down a subsidiary form, just put thisform.release whereever appropriate and it will return to the calling program Dave Dardinger
 
Plus, Your whole trouble stems from misunderstanding the READ EVENTS, CLEAR EVENTS command.

A program only needs ONE 'READ EVENTS' statement; this is the event loop for the whole program. CLEAR EVENTS lets the main program continue running (usually to do some cleanup as part of quitting).

To get an error message, (or whatever.. a picker dialog, etc) to open in front of the main form and to be like a normal dialog (where you have to close it to get back to the main form), set the error message form's WindowType to "Modal" (1, I think). Now, when it is called with DO FORM, it will grab and hold the focus until it is closed, no additional READ EVENTS necessary.

(the other way to make a form modal, if it is designed as a class, is to instantiate the form, then call it's SHOW method with a parameter of 1 to make it show modally; this overrides the WindowType)
 
Once again ... Thanks for setting me straight!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top