%IUP_CLOSE = -3
%IUP_ERROR = 1
extern lib "iup.dll" cdecl
! IupOpen()
! IupCreate(string cname) as sys
! IupClose ()
! IupSetAttributes (sys ih,string strz) as sys
! IupAppend (sys ih, child) as sys
! IupRefresh (sys ih)
! IupSetCallback (sys ih,string sname, sys func) as sys
! IupShow (sys ih) as sys
! IupSetFocus (sys ih) as sys
! IupMainLoop ()
end extern
extern cdecl
'Exit Button Callback
function quit_cb() as sys
function = %IUP_CLOSE
end function
'Helper functions
'================
sub AddChild(sys *parent, *child)
IupAppend parent,child
IupRefresh parent
end sub
function Create ( string Value ,Attr ,sys parent) as sys
sys hWnd
hWnd = IupCreate(Value)
If hWnd Then
If Len(Attr)
IupSetAttributes(hWnd,Attr)
End If
If parent
AddChild parent,hWnd
End If
Function = hWnd
End If
end function
function main () as sys
long rv As long
sys win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame,
controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame,
text,bottomBox,label,entry,btnSearch,chkAll,chkUTF
'Initialize IUP
IupOpen()
'Create Main Window
win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",0)
'create container to house ALL GUI objects
vbox = Create("vbox","MARGIN=10x10",0)
'Create Server panel
topBox = Create("hbox", " GAP=10", vbox)
serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
serverBox= Create("hbox", "GAP=5", serverFrame)
serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
'Create control panel
controlFrame = Create("frame", "TITLE=Controls", topBox)
controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
'SETUP CALLBACK FOR EXIT BUTTON
IupSetCallback(btnExit, "ACTION", @quit_cb)
'Create dictionary panel
dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)
'Create text part
transFrame = Create("frame", "TITLE=Translation", vbox)
text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)
'Create entry and search button
bottomBox = Create("hbox", "GAP=10", vbox)
label = Create("label", "TITLE=Enter Word to Search For: , SIZE=x12", bottomBox)
entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
'
'Add the main GUI container to the Window
AddChild(win, vbox)
'Show the Window
IupShow(win)
IupSetFocus(btnFetch)
IupMainLoop()
IupClose()
end function
main