Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent abuse
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00321381
Message ID:
00326023
Views:
27
>Chapter 3 from Nightmare on VFP Street?
>

It's just an attempt to get the code to stay alive during the removal; since things are Destroyed inside out, the child button has to be released before the parent container, so where does VFP pass control when the RemoveObject is done if the context is no longer valid...

>>
>>I'd try to avoid the headache here by having something outside the containership (a hidden control maybe) do the dirty work, and send control and focus to it, so that I'm not trying to kill something that contains my current code context. Maybe something like the following:
>>
>>(1) Create a form property oThingToKill. At Init() set it NULL
>>(2) Create a control subclass based on a class with a WHEN (TextBox is OK); does not matter which. In the When of the control:
>>
>>
IF VARTYPE(thisform.oThingToKill) = 'O' AND ! ISNULL(thisform.oThingToKill)
>>   LOCAL oParentOfCondemned
>>   oParentOfCondemned = thisform.oThingToKill.Parent
>>   oParentOfCondemned.RemoveObject(thisform.oThingToKill)

the line should read:

   oParentOfCondemned.RemoveObject(thisform.oThingToKill<b>.Name</b>)

>>ENDIF
>>thisform.oThingToKill = NULL
>>RETURN .F.
>>
>>(3) Instance the subclassed control on your form, call it 'txtAssasin' or something on those lines. It should not be visible but should be enabled.
>>
>>(4) In the Click() of the child control that demands the RemoveObject:
>>
>>thisform.oThingToKill = this.parent
>>thisform.txtAssasin.SetFocus()

>>
>>This is completely untried, but should give you a start that will rely on some control not contained in the thing being Removed handling the Remove process.
>>
>>This still sounds like a bad way to do things, but it's your design nightmare, not mine!
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform