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

passing parameter to form's property

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
Dear all,

I've create a property to assign it as user-defined form and needed to pass parameters to its own class for later processing after this property (assigned as a form) is called.How should i do? By the way,I'm not using 'do form' methods.

Coding in .PRG file
define class btn_ret as CommandButton
procedure click
for each frm_ in _screen.forms
if alltrim(frm_.name) == "MAIN"

local vl_height,vl_width,vl_result
vl_height = frm_.height/2
vl_width = frm_.width/2
frm_.addproperty("retfrm")
frm_.retfrm = createobject("returnfrm")
frm_.retfrm.show()
frm_.retfrm.para1 = "test" ==>Any suggestion is it correct?
frm_.retfrm.move(vl_width-(frm_.retfrm.width/2),;
vl_height-(frm_.retfrm.height/2))
endif
endfor
endpro

define class returnfrm as form
caption = "called Form"
height = 215
alwaysontop = .t.
visible = .t.
movable = .f.

procedure init
LPARAMETERS para1
? para1 =>Suppose this line attempt to accept parameter from caller.Adapt any other good way if possible.
enddefine
 
Code:
The parameters are passed in createobject() command
frm_.retfrm = createobject("returnfrm","test")

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
As simple as that, in CREATEOBJECT() all parameters following the class name are passed to the form class init. You nee LPARAMETERS there to receive the parameters.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top