Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid Event does not fire when I click outside of the ob
Message
De
23/09/1998 19:12:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00119392
Message ID:
00140097
Vues:
26
PMFJI-


>1. when you say "every control's gotfocus sets a self reference to thisform.lastcontrol". i am saying whatever.lastcontrol = "whatever.txtlastname". is there a easier way to set a self reference than typing the name in for each control?

In the base class of every control, put something like this in the gotfocus:
THISFORM.LastControl = THIS

This gives the form an object reference, and not just a control name. This is why it is important to set the form property to .NULL. in the form.destroy, because if there the form holds outstanding object references, it will not release.

>2. when the client clicks on toolbar.cmdsave, and i setfocus, yes the valid is fired, and the messagebox comes up if an error is found. but how can i in otoolbar.cmdsave know that? i do not want to continue with the save if an error was found. know i can set a global variable, but is there a better way?

Whether the toolbar runs the valid, or a special form method runs the valid, you can return .F. all the way back up to the toolbar button. So if you run the valid directly, your tb button syntax would be like:
IF _SCREEN.ActiveForm.LastControl.Valid()
    *button code here
ENDIF
and then if you have a special method handle it, then that method returns .T. or .F.:
IF _SCREEN.ActiveForm.UpdateControls()
    *button code here
ENDIF
Form.UpdateControl()

RETURN THIS.LastControl.Valid()

>3. have not decided if i will setfocus at the toolbar or at the page. but either way i am having trouble with the setfocus syntax. my lastcontrol currently (unless i/you/we come up with a better way) has the "whatever.text1" reference. when i try to "this.lastcontrol.setfocs()", or "this.&lastcontrol..setfocus()" it doesnot work. can not get the syntax right.

The syntax you are trying does not work for the reasons I laid out for your first question. You have to have or get an object reference to set focus to it.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform