' SBx_buttons Example (3 Form Version)
IMPORT iup.bas
IMPORT sbt.inc
IMPORT "SBx"
' Form 1 Callback Routines
SUB frm1_btn1_clicked
PRINT "Form 1 Button 1 Pressed\n"
PRINT "Which Mouse Button: ",CHR(Iup::GetBtnPressed()),"\n"
PRINT "Button Up/Dn State: ",Iup::GetBtnState(),"\n"
END SUB
SUB frm1_btn2_clicked
PRINT "Form 1 Button 2 Pressed\n"
END SUB
SUB frm1_btn3_clicked
PRINT "Form 1 Button 3 Pressed\n"
END SUB
' Form 2 Callback Routines
SUB frm2_btn1_clicked
PRINT "Form 2 Button 1 Pressed\n"
PRINT "Which Mouse Button: ",CHR(Iup::GetBtnPressed()),"\n"
PRINT "Button Up/Dn State: ",Iup::GetBtnState(),"\n"
END SUB
SUB frm2_btn2_clicked
PRINT "Form 2 Button 2 Pressed\n"
END SUB
SUB frm2_btn3_clicked
PRINT "Form 2 Button 3 Pressed\n"
END SUB
' Form 3 Callback Routines
SUB frm3_btn1_clicked
PRINT "Form 3 Button 1 Pressed\n"
PRINT "Which Mouse Button: ",CHR(Iup::GetBtnPressed()),"\n"
PRINT "Button Up/Dn State: ",Iup::GetBtnState(),"\n"
END SUB
SUB frm3_btn2_clicked
PRINT "Form 3 Button 2 Pressed\n"
END SUB
SUB frm3_btn3_clicked
PRINT "Form 3 Button 3 Pressed\n"
END SUB
SUB win_exit
' Good-Bye
END SUB
Iup::Open()
' Form 1 Dialog
win1 = DIALOG()
SETPROPERTIES(win1, "TITLE=\"SBx Form 1\", SIZE=300x")
horzbox1 = HBOX()
SETPROPERTIES horzbox1, "GAP=5"
btn1_1 = BUTTON()
SETPROPERTIES btn1_1, "TITLE=\"Button 1\", EXPAND=HORIZONTAL"
btn1_2 = BUTTON()
SETPROPERTIES btn1_2, "TITLE=\"Button 2\", EXPAND=HORIZONTAL"
btn1_3 = BUTTON()
SETPROPERTIES btn1_3, "TITLE=\"Button 3\", EXPAND=HORIZONTAL"
APPEND horzbox1, btn1_1
APPEND horzbox1, btn1_2
APPEND horzbox1, btn1_3
APPEND win1, horzbox1
Iup::SetCallback win1, "CLOSE_CB", ADDRESS(win_exit())
Iup::SetCallback btn1_1, "BUTTON_CB", ADDRESS(frm1_btn1_clicked())
Iup::SetCallback btn1_2, "ACTION", ADDRESS(frm1_btn2_clicked())
Iup::SetCallback btn1_3, "ACTION", ADDRESS(frm1_btn3_clicked())
Iup::ShowXY(win1,500,200)
' Form 2 Dialog
win2 = DIALOG()
SETPROPERTIES win2, "TITLE=\"SBx Form 2\", SIZE=300x"
horzbox2 = HBOX()
SETPROPERTIES horzbox2, "GAP=5"
btn2_1 = BUTTON()
SETPROPERTIES btn2_1, "TITLE=\"Button 1\", EXPAND=HORIZONTAL"
btn2_2 = BUTTON()
SETPROPERTIES btn2_2, "TITLE=\"Button 2\", EXPAND=HORIZONTAL"
btn2_3 = BUTTON()
SETPROPERTIES btn2_3, "TITLE=\"Button 3\", EXPAND=HORIZONTAL"
APPEND horzbox2, btn2_1
APPEND horzbox2, btn2_2
APPEND horzbox2, btn2_3
APPEND win2, horzbox2
Iup::SetCallback win2, "CLOSE_CB", ADDRESS(win_exit())
Iup::SetCallback btn2_1, "BUTTON_CB", ADDRESS(frm2_btn1_clicked())
Iup::SetCallback btn2_2, "ACTION", ADDRESS(frm2_btn2_clicked())
Iup::SetCallback btn2_3, "ACTION", ADDRESS(frm2_btn3_clicked())
Iup::ShowXY(win2,500,400)
' Form 3 Dialog
win3 = DIALOG()
SETPROPERTIES win3, "TITLE=\"SBx Form 3\", SIZE=300x"
horzbox3 = HBOX()
SETPROPERTIES horzbox3, "GAP=5"
btn3_1 = BUTTON()
SETPROPERTIES btn3_1, "TITLE=\"Button 1\", EXPAND=HORIZONTAL"
btn3_2 = BUTTON()
SETPROPERTIES btn3_2, "TITLE=\"Button 2\", EXPAND=HORIZONTAL"
btn3_3 = BUTTON()
SETPROPERTIES btn3_3, "TITLE=\"Button 3\", EXPAND=HORIZONTAL"
APPEND horzbox3, btn3_1
APPEND horzbox3, btn3_2
APPEND horzbox3, btn3_3
APPEND win3, horzbox3
Iup::SetCallback win3, "CLOSE_CB", ADDRESS(win_exit())
Iup::SetCallback btn3_1, "BUTTON_CB", ADDRESS(frm3_btn1_clicked())
Iup::SetCallback btn3_2, "ACTION", ADDRESS(frm3_btn2_clicked())
Iup::SetCallback btn3_3, "ACTION", ADDRESS(frm3_btn3_clicked())
Iup::ShowXY(win3,500,600)
' Event Loop
windows = 3
WHILE windows
Iup::LoopStep()
this_event = Iup::GetEvent()
this_event = Iup::BB_HTA(this_event)
IF this_event = event{this_event}[0] THEN
ICALL event{this_event}[1]
IF Iup::GetActionName() = "CLOSE_CB" THEN windows -= 1
END IF
SB_msSleep(250)
WEND
Iup::Close