Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent() and DoDefault
Message
 
 
À
08/07/2010 13:07:24
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01464849
Message ID:
01471896
Vues:
34
BTW, if I understood your logic correctly, once the changes have been made, you disable all other pages, correct?

But you still can leave the page and go to another form's object.

I think my idea with NODEFAULT in Page.Deactivate should work.

>Here is my page class. You add this to your memberclass in your pageframe using the visual designed. MAKE SURE YOU ARE BACKED UP. I have seen a class trashed do this after the fact.
>
>
>DEFINE CLASS cpage AS page
>	lRefreshOnPageChange = .f. 
>	name = "cpage"
>	*// backcolor = 16638920 
>	PROCEDURE init()
>		DODEFAULT()
>		* this ldirtyflag is on my form and bindevent fires when the value changes.  
>		* My framework automaticly changes the flag when user enteres data. 
>		IF PEMSTATUS(thisform,"ldirtyflag",5)
>			BINDEVENT(thisform,"ldirtyflag",this,"setdatatosavestatus",1)
>		ENDIF 	
>	ENDPROC 
>
>	PROCEDURE activate()
>		IF this.parent.nCurrentPage <> this.Parent.activepage
>			this.Parent.activatepage(this.Parent.activepage)
>			this.Refresh()
>		ENDIF 
>		this.parent.ncurrentpage = this.Parent.activepage
>		thisform.lockscreen = .f.
>		DODEFAULT()
>	ENDPROC 
>
>	PROCEDURE deactivate()
>		thisform.lockscreen = .t.
>		this.parent.pagechange(this.Parent.activepage)
>		IF PEMSTATUS(this.Parent,"nLastActivePage",5)
>			this.Parent.nLastActivePage = this.Parent.activepage 
>		ENDIF 
>		DODEFAULT()
>	ENDPROC 
>
>	PROCEDURE setdatatosavestatus()
>		IF this.Parent.activepage <> this.pageorder
>			this.Enabled = not thisform.ldirtyflag
>		ENDIF 
>	ENDPROC 
>	
>ENDDEFINE
>
>
>>>>>>Now, since there is exact same code in all pages, it will be nice to bind them to form's custom method. However, how do I prevent users to leave the page using this technique?
>>>>>>
>>>>>
>>>>>Why not use a Page class instead of the default page?
>>>>>
>>>>>Tamar
>>>>
>>>>This is a novel idea. I guess I haven't thought about it as I never used page class before. Do I need to create page class in code? Also, the form is already designed, how can I change page class?
>>>
>>>Hack the vcx and set the memberclass of the pageframe to your new class.
>>>
>>>Note that inits of the member pages will run _before_ any other code, except property evaluations. Also, properties of the pages, during this .init() will be the default properties, not the ones set in the pageframe, so any code relying on order of init firing may be thrown off. Do some tracing to see how this works.
>>
>>How exactly you subclass a page class?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform