This program creates 2 new buttons on a form. The buttons are created just by code and do not come out of the toolbox. Alike this method you can define any other control.
You need just an empty form to get the program going.
The Code:
STATIC PUBLIC SUB Main() DIM hForm AS Fmain hForm = NEW Fmain hForm.show END ' Gambas class file b AS Button b1 AS Button t AS Textbox PUBLIC SUB _New() b = NEW Button(ME) AS "MyButton" b.show b.Caption = "Show" t = NEW TextBox (ME) AS "Text" t.x = 200 t.y = 200 t.Height =100 t.Width = 200 t.show b1 = NEW Button(ME) AS "End" b1.Caption = "End" b1.x = 100 b1.y = 100 b1.show END PUBLIC PROCEDURE MyButton_Click() t.text = "My button was hit !" END PUBLIC PROCEDURE End_Click() ME.Close END
An even simpler version of the program.
' Gambas class file ' der Button wird erst im Programmablauf neu erstellt. b AS Button PUBLIC SUB _New() b = NEW Button(ME) AS "Button1" b.show b.Caption = "Ende" END PUBLIC PROCEDURE Button1_Click() ME.Close END
-- ReinerHoffmann - 18 Sep 2004