Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Read Events not working with CrateObject()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00652647
Message ID:
00652654
Views:
18
Leeroy,

Perhaps frmMyForm is going out of scope. You can make it modal (added line below). Alternatively, if you are running this from another form and you want both forms to be operational, I suppose you can make the form be a property of the current form:
thisform.frmMyForm = createobject("Form")
You shouldn't need the second READ EVENTS in either case. In the CLICK() method below, I don't think you should have a CLEAR EVENTS either, but a thisform.release().

>Using the CreateObject() and AddObject() to create a form at runtime. When I call such code from an EXE or complied project the new form flashes and disappears. I am guessing the "Read Events" is being ignored since I already have one at the begining of the application.
>
>Therefore, how do the second "Read Events" does not work what is my alternative?
>
>
>
>frmMyForm = CREATEOBJECT('Form') && Create a Form
>frmMyForm.Closable = .f. && Disable the Control menu box
frmMyForm.windowType = 1 && modal
>
>
>frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn')
>
>frmMyForm.cmbCommand1.Visible =.T. && "Quit" Command button visible
>
>frmMyForm.SHOW && Display the form
>READ EVENTS && Start event processing
>
>DEFINE CLASS cmdMyCmdBtn AS CommandButton && Create Command button
> Caption = '\> Cancel = .T. && Default Cancel Command button (Esc)
> Left = 125 && Command button column
> Top = 210 && Command button row
> Height = 25 && Command button height
>
> PROCEDURE Click
> CLEAR EVENTS && Stop event processing, close Form
> CLEAR && Clear main Visual FoxPro window
>ENDDEFINE
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform