KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Can't delete controls created from the controls collection

 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
Bert
KiXforms Regular
KiXforms Regular


Joined: 06 Oct 2003
Posts: 56
Location: Netherlands

PostPosted: Mon Oct 06, 2003 8:13 pm    Post subject: Can't delete controls created from the controls collection Reply with quote

Hi,
I am doing some testing with Kixforms 2.3.0.41.
I like Kixforms a lot, but I found some issues I like to mention.

When I create controls using the controsl collection I cant delete the controls by setting them to 0.
The following Kixlet demonstrates this:

Code:

$Form = createobject ("kixtart.form")
$Form.center
$combobox1 = $Form.controls.combobox ("", 50, 50, 200, 40)
$combobox2 = $Form.combobox ("", 50, 100, 200, 40)
$text1 = $Form.controls.textbox ("text", 50, 150, 200, 20)
$text2 = $Form.textbox ("text", 50, 200, 200, 20)
$button = $Form.controls.button ("DELETE CONTROLS", 50, 250, 200, 20)
$button.onclick = "$$combobox1 = 0 $$combobox2 = 0 $$text1 = 0 $$text2 = 0"
$Form.show
while $Form.Visible
   $=Execute($Form.DoEvents())
Loop
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Mon Oct 06, 2003 8:36 pm    Post subject: Reply with quote

Shawn says that behavior is by design.

Maybe he'll jump on for further explanation.
Back to top
View user's profile Send private message MSN Messenger
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Mon Oct 06, 2003 8:45 pm    Post subject: Reply with quote

Aha. More explanation...

Objects created by the Controls collection have an extra lease on life, of sorts. They only get destroys when the parent gets destroyed.

Alternatively, you could use the undocumented method, Dispose()

Code:

$Form = createobject ("kixtart.form")
$Form.center
$combobox1 = $Form.controls.combobox ("", 50, 50, 200, 40)
$combobox2 = $Form.combobox ("", 50, 100, 200, 40)
$text1 = $Form.controls.textbox ("text", 50, 150, 200, 20)
$text2 = $Form.textbox ("text", 50, 200, 200, 20)
$button = $Form.controls.button ("DELETE CONTROLS", 50, 250, 200, 20)
$button.onclick = "$$combobox1.Dispose() $$combobox2.Dispose() $$text1 = 0 $$text2 = 0"
$Form.show
while $Form.Visible
   $=Execute($Form.DoEvents())
Loop
Back to top
View user's profile Send private message MSN Messenger
Bert
KiXforms Regular
KiXforms Regular


Joined: 06 Oct 2003
Posts: 56
Location: Netherlands

PostPosted: Tue Oct 07, 2003 3:39 pm    Post subject: Reply with quote

Thanx for the response.
Is Dispose() supported or should I us an intermediate grouping control (not created through the controls) and then delete that with all its containing controls?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group