81
What's New / Re: Script BASIC Windows 32 bit - IUP Threading
« Last post by Support on February 17, 2017, 11:12:52 PM »I was able to use SBT and run multiple IUP GUI threads.
iup_3buttonsboot.sb
iup_3buttons_1
iup_3buttons_2
iup_3buttonsboot.sb
Code: Script BASIC
- IMPORT sbt.sbi
- IMPORT iup.sbi
- sb1 = SB_ThreadStart("iup_3buttons_1.sb",undef,"C:/Windows/SCRIBA.INI")
- SB_msSleep(2500)
- sb2 = SB_ThreadStart("iup_3buttons_2.sb",undef,"C:/Windows/SCRIBA.INI")
- LINE INPUT wait
- Iup::Close()
- SB_Destroy(sb1)
- SB_Destroy(sb2)
iup_3buttons_1
Code: Script BASIC
- ' 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()
iup_3buttons_2
Code: Script BASIC
- ' IUP Button / Event Example
- IMPORT iup.sbi
- SUB Btn1_clicked
- PRINT "Thread 2 - Button 1\n"
- END SUB
- SUB Btn2_clicked
- PRINT "Thread 2 - Button 2\n"
- END SUB
- SUB Btn3_clicked
- PRINT "Thread 2 - 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 2\", 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()