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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to exit many function procedure 1

Status
Not open for further replies.

Polly66

Programmer
Nov 3, 2001
42
AU
Hi everyone.
I have been dabbling with VFP for some time but still have a lot to learn. What I would like to know is, is there a recommended way of exiting a many function procedure and returning to the respective form. I am using VFP9 and XP, and using different forms with option buttons as a menu. Should I be better off using menus or toolbars.
Thanks
Bill Shepherd
 

Bill,

I'm not sure what you mean by a "many function procedure". A function is very similar to a procedure. The way to exit a function or procedure is to issue a RETURN command.

However, I feel that this is not what you are asking, especially as you mentioned toolbars and menus.

Perhaps you could explain in more detail exactly what you are trying to achieve.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike, thanks for the reply. So that you can understand better, I have to tell you the following. I haven’t done any of this sort of work for a few years, and all of my previous efforts either ran under DOS, or DOS boxes, and was in CA Clipper. I know that a “return” or “return to master” is the usual way of exiting forms, and then returning to another form, but sometimes, (almost certainly due to my coding) it doesn’t work. I did not want to use system menus as they take over the whole screen, but now think that a menu is what I must use. Thank you for your time in responding to my, what is in hindsight, a rather stupid question.
Kind regards.
Bill
 
That question is not stupid at all.

The form closes with some procedure that ends like this:

ThisForm.Release()


There is no RETURN required IF all the cleanup of your code and objects is handled. Any dangling refrences to any object will cause the form to hang.




Don Higgins
 

Bill,

Thanks for the explanation.

First, be aware that RETURN works in VFP the same as it does in Clipper. However, if you place a RETURN in the method of a form, that will simply exit from that method. It doesn't close the form.

To close a form completely, you should do what Don advised: THISFORM.Release. This would normally go in the click event of the form's Close or OK button.

If the form is modal (as determined by its WindowType property), THISFORM.Release will return control to the calling form. This will also happen if the user closes the form interactively, for example by clicking the X button on the title bar.

By default, VFP forms are modeless. In that case, THISFORM.Release doesn't pass control to anywhere in particular. The application will simply wait until the user does something (more precisely, it will wait for an event to process). In practice, the user would then interact with any other form that happens to be open, or make a selection from a menu.

I hope this makes sense. Let me know if you need any further explanation.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike,

Thank you very much for the time that you took with me and my problem. Your answer was most informative, and I am really appreciative of your reply. VFP isn't easy for me, and the on-line help sometimes isn't always as explanatory as those books were, that were once part of your purchase. However with a bit of help I hope to to get there in the end.

Thanks again
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top