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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADDING METHODS TO FORMS

Status
Not open for further replies.

tonyr500

Programmer
Nov 7, 2009
1
GB
Hi
Can anyone help me with the exact method of putting a user (programmer) defined procedure or method into a form using the NEW notation. The following code works perfectly,but how do I replace form.close() a standard method of form class with my own procedure or method which is still a method of the form (f1) and can access all form properties.

For example f1.pushbutton1.OnClick={;seeme()} where seeme is a UDF to make text1 visible (f1.text1.visible=.t.)doesn't work. It gives 'Data type mismatch. Expecting object' when the button is clicked.

This doesn't really surprise me but what is the solution?

This particular form is just an experiment to try to solve this problem and also for learning purposes.
Many Thanks
TonyR

LOCAL f1

f1=NEW FORM()
f1.left=67
f1.top=10
f1.height=25
f1.width=100
text1=NEW TEXT(f1)
f1.text='I AM A FORM'
f1.text1.text='THIS IS A FORM'
f1.text1.top=10
f1.text1.height=1
f1.text1.left=50
f1.text1.width=30
f1.text1.FontBold=.f.
f1.text1.visible=.f.
pushbutton1=NEW PUSHBUTTON(f1)
f1.pushbutton1.left=10
f1.pushbutton1.top=20
f1.pushbutton1.height=2
f1.pushbutton1.width=12
f1.pushbutton1.text='click me'

f1.pushbutton1.OnClick={;form.close()}

f1.open()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top