Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create form

Status
Not open for further replies.

bon011

Programmer
Jun 2, 2002
155
CZ
Hi all,

I wont to create form from procedure. I have create this form in form builder.

Is any chance to generate somehow this (form)code that can I paste into procedure?
Thanks
 
bon011

Is it unclear what you want to do. If you want to call an already existing form from a procedure use

DO FORM myForm.scx

Or if you need to create the for in the procedure use :

Local oForm
oForm = CREATEOBJECT("form")
oForm.show(1)



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I want to get code to create the form from existing from.
For example when I have from that have one commandbutton.
Can I get code from this form that can I paste into procedure?

Local oForm
oForm = CREATEOBJECT("myform")
oForm.show(1)

**This code bellow I need to get. Is Any possibility?
DEFINE CLASS myform AS form
Top = 0
Left = 0
Height = 198
Width = 337
DoCreate = .T.
Caption = "Form1"
Name = "clsavoidclick"
AutoCenter = .T.

ADD OBJECT command1 AS commandbutton WITH ;
Top = 72, ;
Left = 34, ;
Height = 27, ;
Width = 84, ;
Caption = "Command1", ;
Default = .T., ;
TabIndex = 2, ;
Name = "Command1"

PROCEDURE command1.Click
MESSAGEBOX("I was Clicked!")
ENDPROC
ENDDEFINE

 
Bon011

I want to get code to create the form from existing from.

Load the class browser, and open it, switch the file type at the bottom from class to form, find your form and once the form is loaded in the class browser use the "view code" button.
A word of caution the code that this might produce is usable most of the time in a function, but in some case (like grids) it may not work. It is "pseudo-code", meaning it is the code that VFP uses to generate the form, which might not always work.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yeah, that is exactly what I was looking for.

Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top