Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simplest way to prevent Deactivate in the page's Click
Message
De
30/06/2005 14:27:37
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01027764
Message ID:
01027804
Vues:
10
>>>>>>Since you cannot prevent the Deactivate event itself from happening, one way would be to store the current active page number/name in a property in Activate() event, then in Deactivate() compare and conditionally execute/not execute the other Deactivate() code.
>>>>>
>>>>>This is what I'm trying to do, but it's not working. In the Deactivate you're still on that page. When you finish the Deactivate, you switch.
>>>>>
>>>>>Do you have other ideas?
>>>>>
>>>>>I have an idea of using shape or some controls like mhTab, etc., but it's too much work and I'd rather avoid this kind of complexity...
>>>>>
>>>>>You see, I need to work around a bug from MS. It seems like no simple workaround exist... I tried to code in the Click event, it doesn't help.
>>>>>
>>>>>Can you play with it a little bit, if you have a minute? Perhaps you can invent an elegant and simple solution.
>>>>>
>>>>>Thanks a lot in advance.
>>>>
>>>>Have you tried code in the UIEnable event of one of the controls on the page?
>>>
>>>Not yet. There is a special class in the framework, which is added in the form's run-time. I haven't looked deep into its code.
>>>
>>>Anyway, could you please elaborate more on your idea? I think it should work, but I'm not sure I see it clearly in my mind.
>>>
>>>Thanks a million in advance.
>>
>>When a page Activates/Deactivates, the UIEnable event fires with a parameter telling which was done. I use it all the time and I have it a particular base class of an object I put on every page. You could build the addition of this object to the pages in the PageFrame.Init().
>
>Let me study UIEnable event. The framework uses the exact same approach, e.g. it adds a special object to each page. Did you already have a workaround for this bug? Can you post your code, if it's not too much to ask?
>
>Thanks again for turning me in the right direction.

I don't use the code to prevent moving to different pages (I did in other projects, but don't have the code for that available). I use it to dynamically refresh labels and other controls to different contents when the page switches. Nothing spectacular, so nothing really to post. Here's a simple example:
* pageframe init
*
* use this for uienabler class (code in refresh method)
*
LOCAL oPage
FOR EACH oPage IN this.Pages
  oPage.NewObject("uienabler","uienabler","mylibrary")		&& uienabler causes refresh of page when pages switched
ENDFOR

*
* use this for uienabler method code (forces first page displayed to refresh correctly)
*
this.ActivePage = this.ActivePage  && or it can be proper hierarchy in the form.Init
* UIEnabler class/UIEnable code
LPARAMETERS lEnable
IF lEnable
  this.Parent.Refresh()		&& force refresh of parent (usually Page)
ENDIF
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform