Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ideas on solution?
Message
 
 
To
31/01/2003 20:25:15
General information
Forum:
Visual FoxPro
Category:
Project manager
Miscellaneous
Thread ID:
00747185
Message ID:
00747968
Views:
15
It doesn't have to be as complex as you coded, this works:
_screen.AddObject( "test1", "myTimer" )

define class myTimer as Timer
Interval = 10000

function Timer()
  ? "fired"
  this.Parent.RemoveObject( this.Name )
endfunc
enddefine
you can use this.parent to get a nameless reference to it's container.

And I just tested this and it seems to work just as well:
function Timer()
  ? "fired"
  release this
endfunc
>Would this be considered anti-OOP because the timer is ASSUMING that it is added to the _Screen? (ie: it is NOT completely encapsulated)
>
>I realize that I could do something like:
>
>_Screen.AddObject('myTimer','myTimer_Class','myWindow',_Screen)
>
>myTimer.Init(cWindowToCheck,oContainer)
>if vartype(oContainer)<>'O'
>  return .f.
>endif
>this.oContainer=oContainer
>
>myTimer.TimerEvent()
>...
>this.oContainer.RemoveObject(this.name)
>
>but it seems like overkill.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform