Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Call 1 form from another
Message
De
27/01/1999 09:22:51
 
 
À
27/01/1999 09:16:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00180717
Message ID:
00180721
Vues:
24
>I have this main form with the foll properties(some)
>MODELESS
>AS TOP LEVEL FORM
>
>I call this from a .prg file
>
>DO FORM main
>READ EVENTS
>
>This runs OK as an EXE with a config.fpw line
>SCREEN=OFF
>
>On this form I have a command button that must launch another form, hiding the main form. This form - Form2, is now the top level form.
>MODAL
>AS TOP LEVEL FORM
>
>
>In the click of the button:
>retval = .F.
>DO FORM form2 TO retval
>
>I don't put a read events as it is not necessary(?)
>
>On click I get an error that the TO clause can only be used in MODAL form or forsets.
>My second form IS modal.I use the TO clause so that my app waits till the form is done and returns a value before continuing which is how I want it.
>
>I can only get this to work by making the form2 as IN TOP LEVEL FORM.
>
>How can I achieve this. It was easy in FPW2.6 to call forms upto 5 levels deep. If I use READ EVENTS to stop the processing of the next line, I have to issue CLEAR EVENTS in the form2 Destroy. This seems to roll back and clears the READ EVENTS of form MAIN.
>
>This is bugging me no end. Has anyone got a solution where I can call another form from a button of one form, wait for that form to finish and return a value, before executing th enext lines?? Form main must be hidden so I will need a TOP LEVEL form2??
>

You can have only one top-level form in your application, just consider it as placeholder for all other forms (i.e. other forms will be open IN topform). You should have only one READ EVENTS (in the root of Main.prg) and btw it will handle modeless forms. There is no limit in opening sequence of modal forms, though generally it's not the best interface. FPW2.x was crippled invalid handling multiple medeless form, now in VFP each form (modeless) is independent (or should be independent) object which may communicate with other form's objects, exchanging values etc. However again, it does not prevent you from using modal forms which may return value straightforwardly by TO clause.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform