#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 a,b) 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" (char *filename, sys mode) as sys
! IupPlayInput Lib "iup.dll" (char *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" (char *iupfont) as string
! IupUnMapFont Lib "iup.dll" (char *driverfont) as string
! IupHelp Lib "iup.dll" (string url) as sys
! IupLoad Lib "iup.dll" (char *filename) as string
! IupLoadBuffer Lib "iup.dll" (char *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" (char *lng)
! IupGetLanguage Lib "iup.dll" () as string
! IupText lib "iup.dll" (char *text)
! 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, char *text, sys len, x, y, byte r, g, b, char *font)
! iupDrawImage Lib "iup.dll" (sys *dc, char *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)
sys canvas,font
Sub iText (sys x,y, string text, sys r,g,b)
iupDrawText *canvas, text, len(text), x,y, r,g,b, 0
End Sub
IupOpen(0,0)
win = iupCreate "dialog"
iupSetAttributes win,"TITLE=INSANITY, SIZE=174x148"
iupShow win
canvas = IupDrawCreateCanvas *win
iupDrawRectangle *canvas, 0,0, 244,238, 254,72,170, 1
iupDrawRectangle *canvas, 1,1, 243,237, 254,92,270, 1
iText 50,20, "SORRY MISTER IUP !",255,25,25
iText 80,100,"NO TIME !!",255,255,255
iText 20,120,"I GOT OWN STUPID WORKING.",255,255,100
iText 50,140,"AND THAT " + 500 + "x",55, 255, 10
iText 30,200,"THANK YOU FOR ENQUIRY",255,128,128
iupDrawFlush *canvas
IupMainLoop()
iupDrawKillCanvas *canvas
IupClose()
include "iup.inc"
IupOpen(0,0)
IupShow(IupDialog(IupLabel("Hello World!")))
IupMainLoop()
IupClose()
include "iup.inc"
sys win
Sub Btn1_clicked()
PRINT "BUTTON 1 Event"
End Sub
Sub Btn2_clicked()
PRINT "BUTTON 2 Event"
End Sub
Sub Btn3_clicked()
PRINT "BUTTON 3 Event"
End Sub
IupOpen(0,0)
win=IupCreate("dialog")
IupSetAttributes win, "TITLE= Test Dialog, SIZE=300x"
horzbox = IupCreate("hbox")
IupSetAttributes(horzbox, "GAP=5")
btn1 = IupCreate("button")
IupSetAttributes(btn1, "TITLE=Button1, EXPAND=HORIZONTAL")
btn2 = IupCreate("button")
IupSetAttributes(btn2, "TITLE=Button2, EXPAND=HORIZONTAL")
btn3 = IupCreate("button")
IupSetAttributes(btn3, "TITLE=Button3, EXPAND=HORIZONTAL")
IupAppend(horzbox, btn1)
IupAppend(horzbox, btn2)
IupAppend(horzbox, btn3)
IupAppend(win, horzbox)
IupSetFunction(btn1, Btn1_clicked) 'IupSetCallback crashed!
IupSetFunction(btn2, Btn2_clicked) 'IupSetCallback crashed!
IupSetFunction(btn3, Btn3_clicked) 'IupSetCallback crashed!
IupShow(win)
IupMainLoop()
IupClose()
include "iup.inc"
sys canvas,alpha,beta,ox=200,oy=140
single x,y,h
Sub Cone()
for alpha=0 to 360 step 8
x = 100*cos(rad(alpha))
y = sin(rad(alpha))*sin(rad(beta)) * 80
h = 100*cos(rad(beta))
iupDrawLine *canvas,ox,oy, ox+x,oy-(y-h), 255,255,255,1
next
End Sub
IupOpen(0,0)
win= iupCreate "dialog"
IupSetAttributes win,"TITLE=CONE,SIZE=300x200"
iupShow win
canvas= IupDrawCreateCanvas *win
cone()
iupDrawFlush *canvas
iupMainLoop
iupDrawKillCanvas *canvas
iupDestroy win
iupClose
include "iup.inc"
IupOpen(0,0)
iupMessage "WARNING","Mayflies attack"
iupMainLoop()
iupClose()
IupSetFunction(btn1, Btn1_clicked) 'IupSetCallback crashed!
IupSetFunction(btn2, Btn2_clicked) 'IupSetCallback crashed!
IupSetFunction(btn3, Btn3_clicked) 'IupSetCallback crashed!
' ! IupSetCallback Lib "iup.dll" (sys ih, char *sname, sys func) as sys callback
! IupSetCallback Lib "iup.dll" (sys ih,string sname, sys func) as sys
include "iup.inc"
sys win
Sub Btn1_clicked()
PRINT "BUTTON 1 Event"
End Sub
Sub Btn2_clicked()
PRINT "BUTTON 2 Event"
End Sub
Sub Btn3_clicked()
PRINT "BUTTON 3 Event"
End Sub
IupOpen(0,0)
win=IupCreate("dialog")
IupSetAttributes win, "TITLE= Test Dialog, SIZE=300x"
horzbox = IupCreate("hbox")
IupSetAttributes(horzbox, "GAP=5")
btn1 = IupCreate("button")
IupSetAttributes(btn1, "TITLE=Button1, EXPAND=HORIZONTAL")
btn2 = IupCreate("button")
IupSetAttributes(btn2, "TITLE=Button2, EXPAND=HORIZONTAL")
btn3 = IupCreate("button")
IupSetAttributes(btn3, "TITLE=Button3, EXPAND=HORIZONTAL")
IupAppend(horzbox, btn1)
IupAppend(horzbox, btn2)
IupAppend(horzbox, btn3)
IupAppend(win, horzbox)
IupSetCallback(btn1, "ACTION", @Btn1_clicked)
IupSetCallback(btn2, "ACTION", @Btn2_clicked)
IupSetCallback(btn3, "ACTION", @Btn3_clicked)
IupShow(win)
IupMainLoop()
IupClose()
include "iup.inc"
Sub WinExit()
IupExitLoop
End Sub
sys dlg,lbl
IupOpen 0,0
dlg = iupCreate "dialog"
lbl = IupLabel "HELLO MISTER IUP !"
IupSetCallback dlg,"IUP_CLOSE", WinExit
IupAppend dlg, lbl
IupShow dlg
IupMainLoop
IupClose
' IUP Button / Event Example
IMPORT iup.bas
SUB Btn1_clicked
PRINT "BUTTON 1 Event\n"
END SUB
SUB Btn2_clicked
PRINT "BUTTON 2 Event\n"
END SUB
SUB Btn3_clicked
PRINT "BUTTON 3 Event\n"
END SUB
SUB Win_exit
Iup::ExitLoop = TRUE
END SUB
Iup::Open()
win = Iup::Create("dialog")
Iup::SetAttributes(win, "TITLE=\"Test Dialog\", 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::Close()
sub Btn2_clicked() callback
print "BUTTON 2 Event"
end sub
include "iup.inc"
sys win
Sub Btn1_clicked() callback
IupMessage "OKAY","BUTTON 1 Event"
End Sub
Sub Btn2_clicked() callback
IupMessage "OKAY","BUTTON 2 Event"
End Sub
Sub Btn3_clicked() callback
IupMessage "OKAY","BUTTON 3 Event"
End Sub
Sub Btn4_clicked() callback
IupMessage "OKAY","BUTTON 4 Event"
End Sub
IupOpen 0,0
win=IupCreate("dialog")
IupSetAttributes win, "TITLE= Test Dialog, SIZE=300x"
horzbox = IupCreate("hbox")
IupSetAttributes(horzbox, "GAP=5")
btn1 = IupCreate("button")
IupSetAttributes(btn1, "TITLE=Button1, EXPAND=HORIZONTAL")
btn2 = IupCreate("button")
IupSetAttributes(btn2, "TITLE=Button2, EXPAND=HORIZONTAL")
btn3 = IupCreate("button")
IupSetAttributes(btn3, "TITLE=Button3, EXPAND=HORIZONTAL")
btn4 = IupCreate("button")
IupSetAttributes(btn4, "TITLE=Button4, EXPAND=HORIZONTAL")
IupAppend(horzbox, btn1)
IupAppend(horzbox, btn2)
IupAppend(horzbox, btn3)
IupAppend(horzbox, btn4)
IupAppend(win, horzbox)
IupSetCallback(btn1, "ACTION", Btn1_clicked)
IupSetCallback(btn2, "ACTION", Btn2_clicked)
IupSetCallback(btn3, "ACTION", Btn3_clicked)
IupSetCallback(btn4, "ACTION", Btn4_clicked)
IupShow win
IupMainLoop
IupClose
You must have a magical version of O2 that makes IUP listen to you.
You can also use external instead of callbackwell i don't know that ,so on this way will work any GUI wraper
typedef int (*Icallback)(Ihandle*);
function setfunction(char*s,Icallback i) as sys
print "Set function addr " i
call i
end function
sub cb() callback
print "cb here"
end sub
setfunction("",@cb)
include "iup.inc"
sys win
Sub Btn1_clicked() callback
static sys a
a +=1
PRINT "BUTTON 1 Event " + a "x pressed"
End Sub
Sub Btn2_clicked() callback
static sys a
a +=1
PRINT "BUTTON 2 Event " + a "x pressed"
End Sub
Sub Btn3_clicked() callback
static sys a
a +=1
PRINT "BUTTON 3 Event " + a "x pressed"
End Sub
IupOpen(0,0)
win=IupCreate("dialog")
IupSetAttributes win, "TITLE= Test Dialog, SIZE=300x"
horzbox = IupCreate("hbox")
IupSetAttributes(horzbox, "GAP=5")
btn1 = IupCreate("button")
IupSetAttributes(btn1, "TITLE=Button1, EXPAND=HORIZONTAL")
btn2 = IupCreate("button")
IupSetAttributes(btn2, "TITLE=Button2, EXPAND=HORIZONTAL")
btn3 = IupCreate("button")
IupSetAttributes(btn3, "TITLE=Button3, EXPAND=HORIZONTAL")
IupAppend(horzbox, btn1)
IupAppend(horzbox, btn2)
IupAppend(horzbox, btn3)
IupAppend(win, horzbox)
IupSetCallback(btn1,"ACTION", @Btn1_clicked)
IupSetCallback(btn2,"ACTION", @Btn2_clicked)
IupSetCallback(btn3,"ACTION", @Btn3_clicked)
IupShow(win)
IupMainLoop()
IupClose()
! IupSetCallback Lib "iup.dll" (sys ih, char *sname, sys func) as sys callback
' ! IupSetCallback Lib "iup.dll" (iHandle *ih, char *sname, sys func) as sys callback
Windows XP/Vista/7 Visual Styles
Windows Visual Styles can be enabled using a manifest file. Uncomment the manifest file section in "iup.rc" file or copy it to your own resource file (you will need also to copy the manifest file "iup.manifest").
When using Visual C++ 8/9/10 with "iup.manifest", configure the linker properties of your project to do NOT generate a manifest file or the Windows Visual Styles from the RC file won't work.
If your Windows is using the Windows Classic theme or any other theme, IUP controls appearance will follow the system appearance only if you are using the manifest. If not using the manifest, then it will always look like Windows Classic.
LinkRes2Exe 1.02 (c)2006 by Mike Henning
Usage: LinkRes2Exe file.res file.exe [-verbose]
Z:\home\jrs\Downloads\OxygenBasic\restool>GoRC -?
GoRC.Exe Version 0.90.5 - Copyright Jeremy Gordon 1998/2009 - JG@JGnet.co.uk
Use this syntax in the command line:-
GoRC [command line switches] inputfile[.ext]
If the inputfile is RC, then by default, both RES and OBJ files are created
Override by using the /o or /r switch or by specifying an output file
Command line switches:-
/b=beep on error
/h=this help
/d=define a word (eg. /d WORD=0x345)
/e=empty output file allowed
/o=create OBJ file
/r=create RES file
/fo=specify output path/file eg. /fo myres.obj
or /fo myres.obj, c:\res\myres.res
/machine AMD64 or /machine X64=object file to be in X64 (X86-64) format
(default is X86 format for 32 bit Windows)
/ne /ni /nw=no error, information, warning messages respectively
/no=no output messages at all
Z:\home\jrs\Downloads\OxygenBasic\restool>
IupShow win
cvas=IupDrawCreateCanvas (win)
IupSetCallback cvas,"ACTION", Text
This is a cheating way to get the canvas to show Peter.
if you do not likes it, then throw it away easily!
This allows programmers to work with large source code libraries, and still produce small binaries.This sounds fine.. :)
include "iup.inc"
iupOpen 0,0
select iupAlarm("iupAlarm test", "File not saved! Save it now?", "Yes", "No", "Cancel")
case 1
IupMessage ("Save file", "File saved successfully - leaving program")
case 2
IupMessage ("Save file", "File not saved - leaving program anyway")
case 3
IupMessage ("Save file", "Operation canceled")
end select
iupClose
This syntax is also supported: