Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
June letter on Visual FoxPro web site
Message
From
02/06/2005 09:19:44
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01019035
Message ID:
01019321
Views:
23
>He, he,
>
>But I need This:
>
>_Screen.AddObject("tool","_tool")
>?_screen.tool.Run()
>CLEAR ALL
>?_screen.tool.Run() && where is my tool?
>
>define CLASS _tool AS custom
>  name="_tool"
>
>  PROCEDURE Run()
>    wait wind "tool..."
>  ENDPROC
>enddefine
>
>
>MartinJ
>

Martin,

a object can survive to the CLEAR ALL command,
but only with a tricked call stack,
and with a autoreplication.

But this big side effect:
CLEAR ALL is catched and it is stopped!

Then it is not a CLEAR ALL,
and at this point,
i'm not sure that VFP's state is integral.
clear
ON ERROR && RETURN TO TOPLEVEL
SET NULLDISPLAY TO "None"

=CREATEOBJECT("replicator")
=ADDPROPERTY(_screen.replicator,"anotherproperty","someValue")

? "object is ",_screen.replicator.TAG
? "anotherproperty is ",_screen.replicator.anotherproperty
? "counter is ",_screen.replicator.counter

* this is stopped
TOPLEVEL()

? "object is ",_screen.replicator.TAG
? "anotherproperty is ",_screen.replicator.anotherproperty
? "counter is ",_screen.replicator.counter

* this is not stopped
TOPLEVEL()

? "object is ",_screen.replicator

PROCEDURE TOPLEVEL

	CLEARALL()
	
PROCEDURE  CLEARALL
	?
	? "clear all"
	CLEAR ALL
ENDPROC 

define CLASS replicator AS custom
	counter = 2
	
  PROCEDURE Init
  	this.Tag = SYS(2015)
  	_Screen.AddPROPERTY("replicator",m.This)
  	? "init",THIS.TAG

  PROCEDURE Error
  	LPARAMETERS nError, cMethod, nLine
  	RETURN TO TOPLEVEL
  
  PROCEDURE DESTROY
  	? "DESTROY",THIS.TAG
  	THIS.counter=THIS.counter-1
  	IF THIS.counter=1
		WITH CREATEOBJECT(m.This.Class)
			FOR I=1 TO AMEMBERS(APROPERTY,m.This,0)
				IF TYPE("this."+APROPERTY[m.i])=="U" OR PEMSTATUS(m.this,APROPERTY[m.i],1)
					LOOP
				ENDIF
				=.ADDPROPERTY(APROPERTY[m.i],GETPEM(m.This,APROPERTY[m.i]))
			NEXT
			* for ... to aevents()....
			* 
		ENDWITH 
		THROW
	ENDIF
  
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform