What am I doing wrong here? Scope Issue?

I have a Container Control, called Alarm. In that Container Control is a Timer. One of the Container control’s Computed Properties sets properties of that timer, but any time I reference Timer1 in this Computed Property I get a NilOjbectException. Maybe it’s because I haven’t slept in a day, but I don’t see what I’m doing wrong in addressing Timer1. Any ideas?

When are you getting the nil object exception ?
When you start the app and open a window with an instance on it ?
Or some other time ?

Is it not enough to be placed on the Container Control? I have to instantiate it in code too? How do I refer to it later in other Methods?

When I call set Alarm1.Enabled=True from the parent window, any reference to Timer1 gives me a nilobjectexception inside the computed property.

My guess: the computed property’s Set is being called before all the controls, including Timer1, have been formed.

by default the SETTER on all computed properties IS called before all controls… This bit me in the… a few weeks ago

NO you dont

Thanks Kem & Dave! That was it!

Added a private boolean property to the Container called IsLoaded. Then added this code to the top of the Computed Property’s Set:

if isLoaded=false then IsLoaded=true return end if