' IUP Button / Event Example
IMPORT iup.sbi
SUB Btn1_clicked
PRINT "Thread 1 - Button 1\n"
END SUB
SUB Btn2_clicked
PRINT "Thread 1 - Button 2\n"
END SUB
SUB Btn3_clicked
PRINT "Thread 1 - Button 3\n"
END SUB
SUB Win_exit
Iup::ExitLoop = TRUE
END SUB
Iup::Open()
win = Iup::Create("dialog")
Iup::SetAttributes(win, "TITLE=\"IUP Thread 1\", SIZE=300x")
horzbox = Iup::Create("hbox")
Iup::SetAttributes(horzbox, "GAP=5")
btn1 = Iup::Create("button")
Iup::SetAttributes(btn1, "TITLE=Button1, EXPAND=HORIZONTAL")
btn2 = Iup::Create("button")
Iup::SetAttributes(btn2, "TITLE=Button2, EXPAND=HORIZONTAL")
btn3 = Iup::Create("button")
Iup::SetAttributes(btn3, "TITLE=Button3, EXPAND=HORIZONTAL")
Iup::Append(horzbox, btn1)
Iup::Append(horzbox, btn2)
Iup::Append(horzbox, btn3)
Iup::Append(win, horzbox)
Iup::SetCallback(win,"CLOSE_CB",ADDRESS(Win_exit()))
Iup::SetCallback(btn1,"ACTION",ADDRESS(Btn1_clicked()))
Iup::SetCallback(btn2,"ACTION",ADDRESS(Btn2_clicked()))
Iup::SetCallback(btn3,"ACTION",ADDRESS(Btn3_clicked()))
Iup::Show(win)
Iup::MainLoop()