Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form disappearing under another form
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00150735
Message ID:
00150853
Views:
16
>>I have spent a few days trying to debug a problem, with no success.
>>VFP 5.0
>>
>>I have a form (form1) (modeless) that is called from a menu. I want Form1 to call the click event for one of its buttons (btnpick). This should open another form (a pick list, lets call it form2, modal). In this list, I choose the button New which opens another form (form3) and I can add a new record to this other table.
>>
>>My problem:
>>
>>If I run form1 and physically click on btnPick, it brings up form2, I click on New from Form2 and get form3 and I can add a new record. All is fine.
>>
>>BUT
>>
>>If I run form1 with the call to the click event on btnpick from form1.init, form2 comes up fine, I choose New and form3 comes up but then control immediately goes back to form1 (i.e. form3 gets covered up by form1).
>>
>>I have traced thru and found that when manually clicking on btnPick in form1, after form2 is unloaded (form3 comes up), control is back on read events and control is in form3 as it should be.
>>
>>If btnpick is automatically clicked in the init of form1, after form2 is unloaded, form3 comes up but control is sent back to form1's activate method.
>>
>>I believe this is because form1 activate hasn't been called yet. If I move the call to btnpick.click from init to a valid on the first field on form1, it works great but this means the user will have to go to the first field and leave it.
>>
>>I need form1 to be sitting at read events and then automatically call btnpick.click without user intervention (i.e the user doesn't touch anything in form1 and the other forms will be called and work right).
>>
>>Case of the misplaced code??
>
>I think so - you shouldn't run a form from an init(), where not everything has completed yet. Activate is the the better place to do it, with a logical property, if needed, to tell if it should be run or not...


Bruce,

I tried putting the code, with a logical test in the activate after dodefault and before dodefault but only the outline of form1 appears before the form2 comes up. Strange, huh?

Thanks for any additional ideas!

Sally
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform