[Gambas-user] overgive a value Nb.II
Jochen Georges
jochen.georges at ...22...
Sat Jan 4 12:05:00 CET 2003
On Saturday 04 January 2003 00:58, Benoît Minisini wrote:
hi benoit
thanks for the code.
i learned a lot :
- there's a keyword OPTIONAL and only one constructor is possible
but one answer left:
> If you display Form2 modal, you can use its contructor _new
> (welcome to the object-oriented programming). If you display
> Form2 modeless, you have to create a public method to update your
> label, and set the Persistent property.
i tried to ignore that and used the constructor for a nonmodal
form,
and it works!
-------------------------------------------------------------------------------
'Fmain.class
PRIVATE hNew AS Fsecond
STATIC PUBLIC SUB Main()
DIM hForm AS Form
hForm = NEW Fmain
hForm.show
END
PUBLIC SUB Button1_Click()
hNew = NEW Fsecond(1, " - with constructor" )
hNew.show
END
PUBLIC SUB Button2_Click()
hNew = NEW Fsecond(1)
hNew.show
END
PUBLIC SUB Button3_Click()
hNew.UpdateLabel(2, " - with self defined method")
hNew.show
END
-------------------------------------------------------------------------------
'Fsecond.class
PUBLIC SUB _new(OPTIONAL X AS Integer, OPTIONAL Y AS String)
TextLabel1.Text=CStr(X) & Y
END
PUBLIC SUB UpdateLabel(X AS Integer, Y AS String)
TextLabel1.Text=CStr(X) & Y
END
-------------------------------------------------------------------------------
More information about the User
mailing list