# How do I make a button by code?

     Gambas class file
      lb AS Label
      btn AS Button

    PUBLIC SUB _new()
      btn = NEW Button(ME) AS "Btn1"
      btn.X = 20
      btn.Y = 30
      btn.Width = 80
      btn.Height = 30
      btn.Caption = "Hello 1"
      btn.enabled = TRUE

      btn = NEW Button(ME) AS "myButton"
      btn.X = 110
      btn.Y = 30
      btn.Width = 80
      btn.Height = 30
      btn.Text = "Hello 2"
      btn.enabled = TRUE

      btn = NEW Button(ME) AS "myButton"
      btn.X = 200
      btn.Y = 30
      btn.Width = 80
      btn.Height = 30
      btn.Caption = "Hello 3"  'or btn.Text = "Hello 3"
      btn.enabled = TRUE

      lb = NEW Label(ME)
      lb.X = 20
      lb.Y = 80
      lb.Width = 200
      lb.Height = 50
      lb.Text = "What will happen?"

    END

    PUBLIC SUB myButton_Click()
      lb.Text = "myButton_Click ("& LAST.Text &")"
    END

    PUBLIC SUB Btn1_Click()
      lb.Text = "Btn1_Click"
    END

-- JochenGeorges - 29 Dec 2004