'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'itest.bas
'bc9c example using the IUP interface library
'translate with -xinc
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
$ONEXIT "cfix $FILE$.c"
'dll
'$ONEXIT "gcc -m32 $FILE$.c -o$FILE$.exe -s -I\iup\include -I\cd-55\include -L\iup -L\cd-55 -liup -liupcontrols -liupcd -lcomctl32 -lole32 -lgdi32 -lcomdlg32 -lcd"
'static
$ONEXIT "gcc -m32 $FILE$.c -o$FILE$.exe -s -static-libgcc -mwindows -I\iup_gw4\include -L\iup_gw4 -liup -liupcontrols -liupcd -lcomctl32 -lole32 -lgdi32 -lcomdlg32"
$ONEXIT "GORC /r $FILE$.rc"
$ONEXIT "LinkRes2Exe $FILE$.res $FILE$.exe"
#include <windows.h>
#include "iup.h"
'CONTROLS, SO MANY DAMN CONTROLS....
Dim As Ihandle Ptr 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(0,0)
'Create Main Window
win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",NULL)
'create container to house ALL GUI objects
vbox = Create("vbox","MARGIN=10x10",NULL)
'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", (Icallback)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="+ enc$("Enter Word to Search For:",0,0)+", 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()
'==============================================================================
function quit_cb() as long
function = IUP_CLOSE
end function
'==============================================================================
sub AddChild(parent as Ihandle ptr, child as Ihandle ptr)
IupAppend(parent, child)
IupRefresh(parent)
end sub
'==============================================================================
'FUNCTION CREATE
' CREATES GUI OBJECT
'
' VALUE = OBJECT CLASS (string)
' ATTR = ATTRIBUTES TO PASS TO OBJECT (string)
' PARENT = PARENT TO PLACE OBJECT ON (Ihandle*)
'------------------------------------------------------------------------------
Function Create (Value as string, Attr as string, parent as Ihandle ptr) as Ihandle ptr
local iHwnd as Ihandle ptr
iHwnd = IupCreate(Value);
If iHwnd Then
If len(Attr) Then
IupSetAttributes(iHwnd, Attr)
End If
If parent Then
AddChild(parent, iHwnd)
End If
Function = iHwnd
End If
Function = NULL
End Function
Is there an official IUP.DLL?
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'I used IUP build 3.5
'http://sourceforge.net/projects/iup/files/3.5/Windows%20Libraries/iup-3.5_Win32_dll6_lib.zip/download
'SED_PBWIN
#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "windows.inc"
#RESOURCE MANIFEST,1, "xpmanifest.xml"
'Change path to iup.dll if need be.
$DLLNAME = "\iup_dll6\iup.dll"
%IUP_CLOSE = -3
%IUP_ERROR = 1
DECLARE FUNCTION IupOpen CDECL IMPORT $DLLNAME ALIAS "IupOpen" (BYVAL argc AS DWORD,BYVAL argv AS DWORD)AS LONG
DECLARE FUNCTION IupCreate CDECL IMPORT $DLLNAME ALIAS "IupCreate"(cname As stringz) AS DWORD
DECLARE SUB IupClose CDECL IMPORT $DLLNAME ALIAS "IupClose"()
DECLARE FUNCTION IupSetAttributes CDECL IMPORT $DLLNAME ALIAS "IupSetAttributes"(BYVAL ih AS DWORD,strz As stringz) AS DWORD
DECLARE FUNCTION IupAppend CDECL IMPORT $DLLNAME ALIAS "IupAppend"(BYVAL ih AS DWORD,BYVAL child AS DWORD) AS DWORD
DECLARE SUB IupRefresh CDECL IMPORT $DLLNAME ALIAS "IupRefresh"(BYVAL ih AS DWORD)
DECLARE FUNCTION IupSetCallback CDECL IMPORT $DLLNAME ALIAS "IupSetCallback"(BYVAL ih As DWORD,sname As stringz,BYVAL func AS DWORD) AS DWORD
DECLARE FUNCTION IupShow CDECL IMPORT $DLLNAME ALIAS "IupShow"(BYVAL ih AS DWORD) As Long
DECLARE FUNCTION IupSetFocus CDECL IMPORT $DLLNAME ALIAS "IupSetFocus"(BYVAL ih As DWORD) AS DWORD
DECLARE SUB IupMainLoop CDECL IMPORT $DLLNAME ALIAS "IupMainLoop"()
FUNCTION PBMAIN () AS LONG
LOCAL rv As LONG
LOCAL win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame, _
controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame, _
text,bottomBox,label,entry,btnSearch,chkAll,chkUTF AS DWORD
'Initialize IUP
rv = IupOpen(0,0)
IF rv = %IUP_ERROR THEN
MsgBox "Initialize Failed"
EXIT FUNCTION
END IF
'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", CODEPTR(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
'==============================================================================
'Exit Button Callback
FUNCTION quit_cb()cdecl AS LONG
FUNCTION = %IUP_CLOSE
END FUNCTION
'***********************************************************************
'Helper functions
'***********************************************************************
'==============================================================================
SUB AddChild(parent As DWORD,child As DWORD)
IupAppend parent,child
IupRefresh parent
END SUB
'==============================================================================
FUNCTION Create ( Value As Stringz,Attr As Stringz,parent As DWORD)AS DWORD
LOCAL hWnd AS DWORD
hWnd = IupCreate(Value)
If hWnd Then
If Len(Attr) Then
IupSetAttributes(hWnd,Attr)
End If
If parent Then
AddChild parent,hWnd
End If
Function = hWnd
End If
END FUNCTION
IMPORT iup.bas
servers[0]="dict.org"
servers[1]="dict1.us.dict.org"
servers[2]="all.dict.org"
about="""This is a Demo
of the IUP GUI Binding
for Scriptbasic"""
' Initialize IUP
Iup::Open()
' Create main window
win = Iup::Create("dialog")
Iup::SetAttributes(win, "TITLE=Thesaurus, SIZE=500x300")
Iup::SetCallback(win,"CLOSE_CB",ADDRESS(Win_exit()))
' Create container to house ALL GUI objects
vbox = Iup::Create("vbox")
Iup::SetAttributes(vbox, "MARGIN=10x10")
' Create server panel
topBox = Iup::Create("hbox")
Iup::SetAttributes(topBox, "GAP=10")
Iup::Append(vbox, topBox)
serverFrame = Iup::Create("frame")
Iup::SetAttributes(serverFrame, "TITLE=Servers, EXPAND=YES")
Iup::Append(topBox, serverFrame)
serverBox = Iup::Create("hbox")
Iup::SetAttributes(serverBox, "GAP=5")
Iup::Append(serverFrame, serverBox)
serverCombo = Iup::Create("list")
Iup::SetAttributes(serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1")
Iup::Append(serverBox, serverCombo)
Iup::SetCallback(serverCombo, "ACTION", ADDRESS(serverCombo_selected()))
btnFetch = Iup::Create("button")
Iup::SetAttributes(btnFetch, "TITLE=Fetch, SIZE = 50x")
Iup::Append(serverBox, btnFetch)
Iup::SetCallback(btnFetch, "ACTION", ADDRESS(btnFetch_clicked()))
' Create control panel
controlFrame = Iup::Create("frame")
Iup::SetAttributes(controlFrame, "TITLE=Controls")
Iup::Append(topBox, controlFrame)
controlBox = Iup::Create("hbox")
Iup::SetAttributes(controlBox, "GAP=5")
Iup::Append(controlFrame, controlBox)
btnAbout = Iup::Create("button")
Iup::SetAttributes(btnAbout, "TITLE=About, SIZE = 50x")
Iup::Append(controlBox, btnAbout)
Iup::SetCallback(btnAbout, "ACTION", ADDRESS(btnAbout_clicked()))
btnClear = Iup::Create("button")
Iup::SetAttributes(btnClear, "TITLE=Clear, SIZE = 50x")
Iup::Append(controlBox, btnClear)
Iup::SetCallback(btnClear, "ACTION", ADDRESS(btnClear_clicked()))
btnExit = Iup::Create("button")
Iup::SetAttributes(btnExit, "TITLE=Exit, SIZE = 50x")
Iup::Append(controlBox, btnExit)
Iup::SetCallback(btnExit,"ACTION",ADDRESS(Win_exit()))
' Create dictionary panel
dictFrame = Iup::Create("frame")
Iup::SetAttributes(dictFrame, "TITLE=Dictionaries")
Iup::Append(vbox, dictFrame)
serverList = Iup::Create("list")
Iup::SetAttributes(serverList, "EXPAND=YES, VISIBLELINES=1")
Iup::Append(dictFrame, serverList)
Iup::SetCallback(serverList, "ACTION", ADDRESS(serverList_selected()))
' Create text part
transFrame = IUP::Create("frame")
Iup::SetAttributes(transFrame, "TITLE=Translation")
Iup::Append(vbox, transFrame)
text = Iup::Create("text")
Iup::SetAttributes(text, "MULTILINE=YES, EXPAND=YES")
Iup::Append(transFrame, text)
' Create entry and search button
bottomBox = Iup::Create("hbox")
Iup::SetAttributes(bottomBox, "GAP=10")
Iup::Append(vbox, bottomBox)
label = Iup::Create("label")
Iup::SetAttributes(label, "TITLE=\"Enter Word to Search For:\", SIZE=x12")
Iup::Append(bottomBox, label)
entry = Iup::Create("text")
Iup::SetAttributes(entry, "EXPAND=HORIZONTAL")
Iup::Append(bottomBox, entry)
btnSearch = Iup::Create("button")
Iup::SetAttributes(btnSearch,"TITLE=Search, SIZE=50x")
Iup::Append(bottomBox, btnSearch)
Iup::SetCallback(btnSearch, "ACTION", ADDRESS(btnSearch_clicked()))
chkAll = Iup::Create("toggle")
Iup::SetAttributes(chkAll, "TITLE=ALL, SIZE=x12")
Iup::Append(bottomBox, chkAll)
chkUTF = Iup::Create("toggle")
Iup::SetAttributes(chkUTF, "TITLE=UTF-8, SIZE=x12")
Iup::Append(bottomBox, chkUTF)
' Add the main GUI container to the Window
Iup::Append(win, vbox)
' Setup dialog defaults
Iup::Show(win)
Iup::SetFocus(btnFetch)
FOR i = 0 TO UBOUND(servers)
Iup::SetAttribute(serverCombo, "APPENDITEM", servers[i])
NEXT
Iup::SetAttribute(serverCombo, "VALUE", "1")
Iup::Update(serverCombo)
server_selection = servers[0]
' Main processing loop
Iup::MainLoop()
Iup::Close()
END
' Callback routines
SUB Win_exit
Iup::ExitLoop = TRUE
END SUB
SUB btnAbout_clicked
Iup::Message("ABOUT", about)
END SUB
SUB serverCombo_selected
server_selection = Iup::GetListText()
END SUB
SUB serverList_selected
whichDictionary = Iup::GetListText()
END SUB
SUB btnFetch_clicked
LOCAL dat, total, count
ON ERROR GOTO G_NetError
OPEN server_selection & ":2628" FOR SOCKET AS #1
PRINT#1,"SHOW DB\n"
LINE INPUT#1, dat
LINE INPUT#1, dat
count = 0
WHILE LEFT(dat, 1) <> "."
LINE INPUT#1, dat
IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
count+=1
WEND
PRINT#1,"QUIT\n"
CLOSE(#1)
FOR cnt = 0 TO count - 2
Iup::SetAttribute(serverList, "APPENDITEM", total[cnt])
NEXT
Iup::SetAttribute(serverList, "VALUE", "1")
Iup::Update(serverCombo)
whichDictionary = total[0]
EXIT SUB
G_NetError:
PRINT "Server ",server_selection," not available. (",ERROR,")\n"
END SUB
SUB btnClear_clicked
Iup::ClearList(serverList)
Iup::SetAttribute(text, "VALUE", "")
Iup::SetAttribute(entry, "VALUE", "")
END SUB
SUB btnSearch_clicked
LOCAL dict, dat, total, info
IUP::SetAttribute(text, "VALUE","Fetching....")
ON ERROR GOTO L_NetError
dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
OPEN server_selection & ":2628" FOR SOCKET AS 1
IF Iup::GetAttribute(chkAll, "VALUE") THEN
PRINT#1,"DEFINE * " & Iup::GetAttribute(entry,"VALUE") & "\n"
ELSE
PRINT#1,"DEFINE " & dict & " " & Iup::GetAttribute(entry,"VALUE") & "\n"
END IF
REPEAT
LINE INPUT#1, dat
IF LEFT(dat, 3) = "151" THEN
total$ &= "------------------------------\r\n"
total$ &= RIGHT(dat, LEN(dat) - LEN(Iup::GetAttribute(entry, "VALUE")) - LEN(dict))
total$ &= "------------------------------\r\n"
REPEAT
LINE INPUT#1, info
info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
UNTIL LEFT(info, 1) = "."
total &= "\n"
END IF
UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
PRINT#1,"QUIT\n"
CLOSE(#1)
IF LEFT(dat, 3) = "552" THEN
total = "No match found."
ELSE IF LEFT(dat, 3) = "501" THEN
total = "Select a dictionary first!"
ELSE IF LEFT(dat, 3) = "550" THEN
total = "Invalid database!"
END IF
Iup::SetAttribute(text, "VALUE", total)
EXIT SUB
L_NetError:
dat[0] = "Could not lookup word! (" & ERROR & ")"
Iup::SetAttribute(text, "VALUE", dat)
END SUB
>"C:\OxygenBasic\gxo2" " -c iup01.o2bas"
ERROR:
parameters mismatch for procedure string:
params given : #long@0
OPTIONS:
string(sys,sys) returns string
string(sys,zstring) returns string
string(sys,string) returns string
WORD: cname
LINE: 9
>Exit code: 0
Could you show the source please James.
'IUP build 3.6 / Win32
%IUP_CLOSE = -3
%IUP_ERROR = 1
extern lib "iup.dll" cdecl
! IupOpen (sys argc,argv) as sys
! 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
rv = IupOpen(0,0)
print "ok" rv
if rv = %IUP_ERROR
print "Initialize Failed"
EXIT FUNCTION
end if
'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
James
extern lib "\iup_dll6\iup.dll"
sys IupOpen (sys argc ,sys argv)
sys IupCreate (char* cname)
void IupClose()
sys IupSetAttributes(sys ih ,char* strz)
sys IupAppend (sys ih ,sys child)
void IupRefresh(sys ih)
sys IupSetCallback (sys ih ,char* sname ,sys func)
sys IupShow (sys ih)
sys IupSetFocus (sys ih)
void IupMainLoop()
void IupMessage(char* title, char *msg)
end extern
'' Initializes IUP
IupOpen(0,0)
'' Executes IupMessage
IupMessage("IupMessage Example", "Press the button")
'' Initializes IUP main loop
IupMainLoop ()
'' Finishes IUP
IupClose ()
extern lib "iup.dll" cdecl
sys iup
iup = LoadLibrary "iup.dll"
....
....
end extern
Where did you get it from?
Aurel,Aha ,i see and i think that would work without .lib file ,only dll.is important for LoadLibrary().
Libs are not supported - I understand they are compiler-specific: FB uses the GNU linker.
The only downside (for me) is that there is no OSX version.
>"C:\OxygenBasic\gxo2" " -c t01.o2bas"
ERROR:
parameters mismatch for procedure string:
params given : #long@0
OPTIONS:
string(sys,sys) returns string
string(sys,zstring) returns string
string(sys,string) returns string
WORD: cname
LINE: 10
>Exit code: 0
I then deleted the oxygen.dll and tried again.
I then got a can't find oxygen.dll popup.
extern lib "\iup_dllw4\iup.dll" cdecl
! IupOpen()
! IupClose()
! IupMessage(string title, string msg)
end extern
IupOpen()
IupMessage("IupMessage Example", "Press the button")
IupClose()
%IUP_CLOSE = -3
%IUP_ERROR = 1
extern lib "\iup_dllw4\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
#define IUP_TITLE "TITLE"
%IUP_CLOSE = -3
%IUP_ERROR = 1
enum { IUP_DRAW_FILL, IUP_DRAW_STROKE, IUP_DRAW_STROKE_DASH }
typedef struct Ihandle_ {}
Ihandle_ Ihandle
typedef int (*Icallback)(Ihandle*)
typedef struct _IdrawCanvas {}
_IdrawCanvas IdrawCanvas
! IupOpen Lib "iup.dll" (sys argc,argv) as sys
! IupCreate Lib "iup.dll" (string cname) as sys
! IupSetAttributes Lib "iup.dll" (sys ih,string strz) as sys
! IupAppend Lib "iup.dll" (sys ih, child) as sys
! IupRefresh Lib "iup.dll" (sys ih)
! IupSetCallback Lib "iup.dll" (sys ih,string sname, sys func) as sys
! IupShow Lib "iup.dll" (sys ih) as sys
! IupShowXY Lib "iup.dll" (Ihandle *ih, sys x, sys y) as sys
! IupSetFocus Lib "iup.dll" (sys ih) as sys
! IupRecordInput Lib "iup.dll" (string *filename, sys mode) as sys
! IupPlayInput Lib "iup.dll" (string *filename) as sys
! IupMainLoop Lib "iup.dll" () as sys
! IupImageLibOpen Lib "iup.dll" () as sys
! IupLoopStep Lib "iup.dll" () as sys
! IupLoopStepWait Lib "iup.dll" () as sys
! IupMainLoopLevel Lib "iup.dll" () as sys
! IupClose Lib "iup.dll" ()
! IupFlush Lib "iup.dll" ()
! IupExitLoop Lib "iup.dll" ()
! IupUpdate Lib "iup.dll" (Ihandle *ih)
! IupUpdateChildren Lib "iup.dll" (Ihandle *ih)
! IupRedraw Lib "iup.dll" (Ihandle *ih, sys children)
! IupRefresh Lib "iup.dll" (Ihandle *ih)
! IupRefreshChildren Lib "iup.dll" (Ihandle *ih)
! IupMapFont Lib "iup.dll" (string *iupfont) as string
! IupUnMapFont Lib "iup.dll" (string *driverfont) as string
! IupHelp Lib "iup.dll" (string url) as sys
! IupLoad Lib "iup.dll" (string *filename) as string
! IupLoadBuffer Lib "iup.dll" (string *buffer) as string
! IupVersion Lib "iup.dll" () as string
! IupVersionDate Lib "iup.dll" () as string
! IupVersionNumber Lib "iup.dll" () as sys
! IupSetLanguage Lib "iup.dll" (string *lng)
! IupGetLanguage Lib "iup.dll" () as string
! iupDrawCreateCanvas Lib "iup.dll" (Ihandle *ih) as sys
! iupDrawKillCanvas Lib "iup.dll" (sys *dc)
! iupDrawFlush Lib "iup.dll" (sys *dc)
! iupDrawUpdateSize Lib "iup.dll" (sys *dc)
! iupDrawGetSize Lib "iup.dll" (sys *dc, *w, *h)
! iupDrawLine Lib "iup.dll" (sys *dc, x1, y1, x2, y2, byte r, g, b, sys style)
! iupDrawRectangle Lib "iup.dll" (sys *dc, x1, y1, x2, y2, byte r, g, b, sys style)
! iupDrawArc Lib "iup.dll" (sys *dc, x1, y1, x2, y2, double a1, a2, byte r, g, b, sys style)
! iupDrawPolygon Lib "iup.dll" (sys *dc, *points, count, byte r, g, b, sys style)
! iupDrawText Lib "iup.dll" (sys *dc, string *text, sys len, x, y, byte r, g, b, string *font)
! iupDrawImage Lib "iup.dll" (sys *dc, string *name, sys make_inactive, x, y, *img_w, *img_h)
! iupDrawSetClipRect Lib "iup.dll" (sys *dc, x1, y1, x2, y2)
! iupDrawResetClip Lib "iup.dll" (sys *dc)
! iupDrawRectangleInvert Lib "iup.dll" (sys *dc, x1, y1, x2, y2)
! iupDrawParentBackground Lib "iup.dll" (sys *dc)
Function quit_cb() as sys
Function = IUP_CLOSE
End Function
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
if Len(Attr)
IupSetAttributes(hwnd,Attr)
End if
if parent
AddChild parent,hwnd
End if
Return hwnd
End if
end function
sys canvas, width, height
Function Main() as sys
IupOpen(0,0)
win = Create("dialog","TITLE=IUP*TEST*PETER, SIZE=300x200",0)
iupShowXY *win,380,180
canvas = IupDrawCreateCanvas *win
iupDrawGetSize *canvas, *width, *height
iupDrawRectangle *canvas, 10, 10, 40, 40, 255, 0, 0, 0
iupDrawRectangle *canvas, 50, 10, 90, 40, 255,255,0, 1
iupDrawRectangle *canvas, 100,10, 140,40, 255,0,255, 2
iupDrawLine *canvas, 0, 100, &width, 100, 0,255,0, 2
iupDrawFlush *canvas
iupMainLoop()
iupDrawKillCanvas *canvas
iupClose()
End Function
Main()