DECLARE SUB NewButton
DECLARE SUB ButtonClick(Sender AS QBUTTON)
ButtonCount=0
DIM Buttons(0) AS QBUTTON
CREATE Form AS QFORM
Center
CREATE Button AS QBUTTON
CAPTION="New button"
OnClick=NewButton
END CREATE
SHOWMODAL
END CREATE
SUB NewButton
ButtonCount=ButtonCount+1
Form.CAPTION="Button Count: "+STR$(ButtonCount)
REDIM Buttons(ButtonCount) AS QBUTTON
Buttons(ButtonCount).PARENT=Form
Buttons(ButtonCount).Top=(ButtonCount-1)*30
Buttons(ButtonCount).Left=80
Buttons(ButtonCount).CAPTION="Button "+STR$(ButtonCount)
Buttons(ButtonCount).OnClick=ButtonClick
END SUB
SUB ButtonClick
SHOWMESSAGE Sender.CAPTION
END SUB
|