Thanks in advance,
Haris
P.S.I use Delphi 4
Take a look at the Screen (of type TScreen) global variable.
Regards... Richard bru...@dsuper.net
In other words form1 is iniallty nil but when you free it you must set it to
nil. As long as you do that
you can check to see if it is nil to see if it is available.
Too bad free doesn't set the pointer to nil.
Haris I. Volos <ha...@nospam.hivolos.com.cy> wrote in message
news:7ns4f5$c5...@forums.borland.com...
Hmmm. I don't know how that could ever work. Which pointer should free set
to nil?
--Ceci.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
The mist crawls from the canal like some primordial phantom of romance
To curl, under the cascade of neon pollen. While I sit tied to the phone
like some expectant father, your carnation will rot in a vase.
(Fish)
--
If you use a singleton object pointer and want to check if it is nil or not, try
placing code in the Forms OnDestroy event and nil, don't free, the object
pointer there. This can lead to a small chance of a timing problem but probably
not enough that it would affect you.
"Haris I. Volos" wrote:
>
> In my program I use forms that are not always are available(To use less
> resourses) and I want to find a way to send them some data if are available.
> In Delphi 3 I was using the try ...except statement but in Delphi 4
> sometimes is raising exceptions.
>
> Thanks in advance,
>
> Haris
>
> P.S.I use Delphi 4
--
That sounds like a convenient function. Of course the programmer is still
responsible for setting an object variable to nil (explicitly or via
FreeAndNil) if he or she is depending on comparisons to nil in the code. I
was just hoping that Art might see that there isn't any practical way to
"FreeAndNil" some magical MyObject variable within the TMyObject destructor.
I can see how that automatic "Form1" variable declaration might make one
think that the variable should some how be automatically nilled out...but if
you think about it just a little further, you see that it wouldn't make much
sense for that to be the case.
--Ceci.
When a singleton object frees itself though, it is better to nil the singleton
pointer in the OnDestroy event. Automatic forms that destroy themselves when
closed are a good example of when to nil things there. As of D5 though, all
objects that are create and normally destroyed by calling Free, should call
FreeAndNil since it is safer.
--
Good point.
--Ceci.