Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form loading flash
Message
De
19/05/2016 23:44:37
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01636239
Message ID:
01636650
Vues:
110
I have an editor for SCX/VCX that uses an ActiveX component -- it is based on CodeMax. From this ActiveX I pop-up many native VFP forms which are over CodeMax. The forms are all modeless by design. I do not have any modal forms (the editor runs inside of VFP and I did not want the modal behavior). To 'simulate' a modal form, I first grey-out the main form via the class from Bernard Bout (bbLightBox class). This class actually takes a screen-shot of the current form (my main form) and then paints it in an image control via GDIx, sets all components to Visible=False, sets the Image to Visible=True and moves it to the top of the z-order (there is alpha blending to darken the image). Now the child pop-up form appears. The Activate() event of the image control (and main form) redirects the user back to the child pop-up form should they try to re-select the main form. I use RAISEEVENTS() command in the child form (commandbutton.click event) to pass data back to the main form from the child pop-up form. The main form is then responsible for destroying the child form and restoring the main form (form controls back to Visible=True and the image to Visible=False and to back of z-order). BINDEVENTS is used in the main form to bind to the child form's QueryUnload and Release events (another reason the forms are modeless -- they have to be created in order to bind to its events). This way if the user closes the child form via the upper right hand close button the main form is restored.

No flashing has ever been noticed... Just a clean pop-up of child forms over what appears to be the editor component but is actually just an image control. The calls to the child forms are similar to:
LOCAL loChildForm
DO FORM GetMaterialsFromSearch WITH thisform, True, DATE() NAME loChildForm
IF VARTYPE(loChildForm) = "O"
	thisform.SetModalBindEvents(loChildForm)
ENDIF
The Init() event of the child form sets the lightbox:
LPARAMETERS toMainForm, tlAllowOrder, tdOrderDate
thisform.OrderDate  = tdOrderDate
thisform.MainForm   = toMainForm
thisform.AllowOrder = tlAllowOrder
toMainForm.clsLightBox.ShowLightBoxInContainer(True)
The main form has to be passed to the child form since RAISEEVENTS needs this to call the main form (from click event method code in button to close form):
RAISEEVENT(thisform.MainForm, "OnFormGetMaterialsFromSearch", True, loMaterials)
The BINDEVENTS is done in SetModalBindEvents() method of the main form as follows:
LPARAMETERS toChildForm
thisform.ChildForm = toChildForm
BINDEVENT(toChildForm, "QueryUnload", thisform, "ReleaseChildForm")
BINDEVENT(toChildForm, "Release", thisform, "ReleaseChildForm")
The ReleaseChildForm() method:
thisform.ChildForm.Hide()
thisform.clsLightBox.ResetLightBox()
UNBINDEVENT(thisform.ChildForm, "QueryUnload", thisform, "ReleaseChildForm")
UNBINDEVENT(thisform.ChildForm, "Release", thisform, "ReleaseChildForm")
thisform.ChildForm.Release()
thisform.ChildForm = .NULL.
Note: I have made my own changes to Bernard's class for controlling which controls are set to Visible=False as I only set the ActiveX controls; his class does all controls if I remember correctly. I did this for performance reasons when there are a lot of controls in the form.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform