![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Forms can't be disposed.
When you dispose a panel only the panel gets disposed. You can use something like: Code:
somearray() = GetControls("Panel1")
for i = 0 to ArrayLen(somearray())-1
Control(somearray(i)).Dispose
next
Code:
Sub ControlExist(crl) ErrorLabel(ControlExistErr) a = ControlType(crl) return true ControlExistErr: return false End Sub |
|
||||
|
I have often used an ArrayList to store the names of all the controls I create dynamically. This works well if I just want to know if a control exists.
More recently, I've switched to using a table, as I can also store the name of the control's parent (form, panel, etc), type, and other stuff I might want to keep track of. Naturally, it's a simple matter to add an item to an array list - or a row to a table - when a control is created, and to remove it when a control is disposed of. Gary
__________________
PC: Windows XP Pro SP3 / Basic4PPC v6.5 PPC: HTC 8925 (AT&T Tilt) / Windows Mobile 6 |
|
||||
|
Thanks Erel.
Although the help file states that Forms do indeed have a Dispose property. I'm currently using a similar code to yours to dispose of the controls on a panel but what about Objects? Can I use a method to determine what Objects are present on the panel and then dispose them? Ideally I would like to create and dispose of the tree view, context menu's and SMS messages as and when required, although if not possible then I will add at the start of the program and leave in place. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
From the lack of responses, do I take it that it's not possible to determine what objects are in use (other than keeping my own record in an array list) and that I can't dispose of them anyway?
Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
I will double check the problem I was having and report back later (about to leave for work now
).Thanks for the reply. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
I found my problem as demonstarted in my sample code attached (just add ControlsEx.Dll to the same dir)...
It appears that Objects do not belong to the panel/form they are applied to, niether do they belong to the main form. Now that I know this, disposing them is not a problem, I'll just keep track of which ones I need to delete. My original intention was just to pass a sub the panel name and have it automatically delete all controls associated with it, I'll just need to re-work this slightly. Thanks for the assistance. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drag controls (name) to the IDE | Mr_Gee | Basic4ppc Wishlist | 2 | 07-21-2008 09:35 PM |
| HOTSPOT controls | WZSun | Code Samples & Tips | 23 | 05-30-2008 02:42 PM |
| COM controls | lairdre | Questions & Help Needed | 3 | 02-28-2008 09:53 AM |
| Controls name | PepSoft | Questions & Help Needed | 4 | 12-17-2007 03:49 PM |
| Tab Order for Controls | BPak | Questions & Help Needed | 2 | 05-06-2007 06:58 AM |