[Gambas-user] A Beginner's Guide to Gambas

Scott Castaline hscast at ...407...
Tue Jul 3 01:48:45 CEST 2007


ron wrote:
> On Monday 02 July 2007 23:23, Benoit Minisini wrote:
>>> PUBLIC SUB Form_Open()
>>>      DIM hButton AS Button
>>>      hButton = NEW Button (ME) AS "hButton"
> 
> 
> in top of your form do instead the FormOpen.
>   PRIVATE hButton AS Button
> 
>   PUBLIC SUB Form_Open()
> '     DIM hButton AS Button  '<----- Rem this line.
>      hButton = NEW Button (ME) AS "hButton"
> 
> The fact is the hButton must be global in the form class.
> It is now local in the Form_Open() 
> 
> For the  line in the Form_open meaning:
>   hButton	: the variable to hold the handle to the object
>   =
>   NEW		: create new instance of the object
>   Button	: the type of object
>   (ME)		: where to place
>   AS		
>   "hButton"	: the 'name' part for event descriptors
> 		: as hButton_Click
> 
> On the events it goes to this sub routine starting with this name
> The object properties however are available on the handle variable
> and not the used name. 
> 
> 
> i.e.
> PUBLIC hButton as Button
> 
>   PUBLIC SUB Form_Open()
>      hButton = NEW Button (ME) AS "MyFancyButton"
> ....
> 
> 
>   PUBLIC SUB MyFancyButton_Click()
>     hButton.caption = "Im the fancy button"
> 
> 
> --
> Ron
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
Now I get "Null Object" and the hButton.Hide is hi-lighted.




More information about the User mailing list