Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Practice-AddObject() to PARENT and THISFORM
Message
From
20/10/2005 06:30:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01060424
Message ID:
01060631
Views:
20
This message has been marked as the solution to the initial question of the thread.
>Hi all
>
>I have a grid class and in it's Init() I ADDOBJECT() THISFORM and THIS.PARENT one each. When I put in the THISFORM.oCustom = .NULL. and THIS.PARENT.oCustom = .NULL. for cleaning up my doings, it seems that the objects are already destroyed by the form and parent classes, fair deal.
>
>But is this the way it should have been handled? Or is there a better OOPian way to do ADDOBJECTS() onto the formand parent classes?
>
>Please advise.

Bhavbhuti,
You're not creating external object references but directly adding objects. So let the form destroy them all:) ie:
public oForm
oForm = createobject('myForm')
oForm.Addobject('myLabel2','Label')
with oForm.myLabel2
  .Caption = "Hello 2"
  .Top = 30
  .Visible = .t.
endwith
oForm.Show

define class myForm as form
 add object myLabel as Label with caption='Hello'
enddefine
No need to try to set thisform.myLabel2 = .null.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform