Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a form from a shortcut menu
Message
De
21/06/1997 08:52:34
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00037113
Message ID:
00037303
Vues:
32
> >>>>>> I have a form that displays a shortcut popup when you right-click > on it. One of the choices in the menu needs to run a method of the form. > How do I reference the form from within the scope of the popup menu? > >>>>>> > >>>>>>TIA > >>>>>> > >>>>>>Mike > >>>>> > >>>>>You should either name of Form scx file or reference name if you used > >>>>>DO FORM ... NAME cRefname > >>>> > >>>>That doesn't seem to work. Here is what I'm looking at: > >>>> > >>>>from main menu > >>>> > >>>>do form customer.scx > >>>> > >>>> > >>>>inside customer.scx > >>>> form1.name = 'Customer_window' > >>>> > >>>>customer_window.rightclick() > >>>> do customermenu.mpr > >>>> > >>>> > >>>>inside customermenu > >>>> customer_window.mymethod(p1,p2) > >>>> > >>>>or > >>>> > >>>> customer.mymethod(p1,p2) > >>>> > >>>> > >>>>either of these gives me the object does not exist error > >>>> > >>>>what am I doing wrong?? > >>> > >>>Try this: > >>>DO FORM customer NAME frmCust > >>>and in menu use: > >>>frmCust.mymethod > >>>Also you can try LINKED clause of DO FORM command > >> > >> > >> > >>Without the LINKED Clause: 'Object frmCust not found' > >> > >>With LINKED Clause: customer form appears briefly and disappears. This > tells me that the frmCust variable is immediately going out of scope. I > was wrong to tell you that the customer form is called from my main menu. > It is actually called in the click event of a button on my main toolbar. > There is no actual main menu. Apparently, the system immediately returns > from the click event after opening the customer form. When it returns, the > frmCust goes out of scope. When Linked is used, this causes form to close. > When linked is not used the form stays open but the variable name no > longer exists. Is there any way to make that variable name global? > >> > >>- Mike > > > >Well, toolbar is another story. You can try to make variable global and I > believe it should work. However, if you have toolbar, is it not part of > formset? If so you can easily use formset relative references from toolbar > to any form which is added to the same formset. > > > > I think I need to attack this from a different direction. Toolbar is not > part of a formset. It is run independently from my application MAIN > program. I think I will just make the function that I'm trying to call > independent from the form so I don't need to reference the form to call it. > Thanks for all your help!! Why don't you use : _Screen.ActiveForm.YourMethod() ?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform