General information
Category:
Coding, syntax & commands
Hi Michael and Arnon thanks for the instance tips. The reason of doing this is I'm trying to include a Customiser Module in my App. so that user can paint their own form and include tables they want. I have try the codes below but error message saying 'Unknown Member DataEnvironment'. What did I do wrong?
x=createobject('FORM')
* Data Environment
x.DataEnvironment.AddObject('cursor1','cursor')
x.DataEnvironment.Cursor1.CursorSource='pyscope'
x.DataEnvironment.InitialSelectedAlias='pyscope'
x.addobject('txt1','textbox')
x.txt1.controlsource='pyscope.cdcomp'
x.txt1.visible=.t.
x.addobject('cmd','cmd3')
x.cmd.visible=.t.
x.show()
read event
DEFINE CLASS cmd3 AS CommandButton && Create Command button
Caption = '\ Cancel = .T. && Default Cancel Command button (Esc)
Left = 125 && Command button column
Top = 150 && Command button row
Height = 25 && Command button height
PROCEDURE Click
sele pyscope
=tableupdate(.t.)
CLEAR EVENTS && Stop event processing, close Form
ENDDEFINE
>>Hi everyone. Like to ask does anyone know how to add a form on run-time with dataenvironment and cursor set. Presently I know how to do the following :
>> x=createobject('form_toolbar')
>> x.addobject('txt1',textbox_)
>> x.txt1.visible=.t.
>> ....
>>
>> x.show()
>>
>>But how do I add object for data environment and cursor. There is example for above in VFP except the ones I'm looking for.
>>
>>Thanks.
>
>assumeing you already have the cflass defenition for the DE
>add a property to your form class the will hold the instance of the DE
>in the load event of the form
>do something like
>thisform.oDE=createobject("myDE")
>now you can do what ever you like with this de instance
>
>Arnon
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only