Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 3, 2012 5:22:41 GMT 1
PROTO IupOpen, IupShow, IupDialog, IupLabel, IupMainLoop, IupClose
IupOpen(NULL,NULL) IupShow(IupDialog(IupLabel("Hello World!"))) IupMainLoop() IupClose()
jrs@laptop:~/BaCon$ ./bacon -o -I/usr/include/iup -i /usr/include/iup/iup.h -l iup helloiup.bac Converting 'helloiup.bac'... done. Compiling 'helloiup.bac'... done. Program 'helloiup' ready. jrs@laptop:~/BaCon$ ./helloiup -rwxrwxr-x 1 jrs jrs 49794 Dec 2 20:15 helloiup Just to emphasize the Portable User Interface aspect of IUP, here is the ScriptBasic version. IMPORT iup.bas
Iup::Open() Iup::Show(Iup::Dialog(Iup::Label("Hello World!"))) Iup::MainLoop() Iup::Close()
jrs@laptop:~/sb/test$ scriba helloiup.sb This same SB code runs untouched on Windows using the Win32API. (native GUI API) C:\scriptbasic\test>scriba hello_iup_win.sb
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 3, 2012 19:18:04 GMT 1
IUP has a built in GUI layout tool that lets you design/change your user interface in the editor and see the changes live in an application window all with one additional API call in your debug version of your code. IMPORT iup.bas
Iup::Open() Iup::Show(Iup::LayoutDialog(Iup::Dialog(Iup::Label("Hello World!")))) Iup::MainLoop() Iup::Close()
As it turns out, I would be best served using BaCon and IUP and embed SB for it's GUI IDE/Designer. The only hesitating factor is it's a *nix only solution.
|
|
|
Post by alexfish on Dec 3, 2012 20:25:29 GMT 1
@ jrs
IUP looks good , and as you say generated code runs on windows > does IUP have any dependencies to do so.
Possible one thing which could help in the gui department may lay in the rad tool demo Jvap.. at present it generates Bacon GTK code via the executor , which is its own plug-in , all it will need is a plug-in to generate the necessary Code.. for IUP IE: IF widget=BUTTON THEN code$="<IUP CODE>" END IF
Remember at present J-vap is in early days of development all are "Beta" , for J-vap a plug in test may be worth trying.
Regards
Alex
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 3, 2012 21:17:32 GMT 1
Have a peek at the IUP site. The on-line docs are great. The IUP layout tool generates C, Lua and its own format code for the GUI part. The CD (Canvas Draw) IUP API uses OpenGL as a dependency. The core IUP API is self contained as I demonstrated with the Hello World BaCon example.
I briefly used Peter's first version of HUG (GTK-Server) when it ran on SB. I tried Gtk on Windows and wasn't impressed. (not a lot of interest by the community) IUP solves this by using the OS native GUI framework.
Linux = Gtk Windows = Win32API OSX = Gtk (a native GUI driver is in the works)
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 5, 2012 2:49:36 GMT 1
Here is an IUP example using the Math GL Plot library. C source for above in a PDF.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 5, 2012 18:29:17 GMT 1
@peter - Is there anyway to make the -i work like -l so I don't have to use the BaCon -o to define the C include path?
|
|
2lss
Full Member
Posts: 140
|
Post by 2lss on Dec 5, 2012 19:12:32 GMT 1
jrs,
Wow that is awesome. I will have to take a look at IUP.
I am forced to use some proprietary windows applications for various engineering related projects. There is virtually nothing comparable in the oss/linux world.
I had a idea a while back to create a crazy maxima/latex/gnuplot parser using bacon but it never really materialized.
Math GL definitely seems like the way to go. I may have to revisit the project.
|
|
|
Post by Pjot on Dec 5, 2012 19:26:46 GMT 1
Well, I am going to implement the idea of 2lss, which means you do not have to use any commandline parameter for libraries and/or header files and/or linker options anymore.
BR, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 6, 2012 2:05:09 GMT 1
Just a heads up for those walking the gtk 2/3 fence.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 6, 2012 8:51:10 GMT 1
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 6, 2012 19:01:56 GMT 1
We were able to get IUP working with OxygenBasic. extern lib "iup.dll" cdecl declare function IupOpen(sys argc,argv) as sys declare function IupShow(sys arg1) as sys declare function IupDialog(sys arg1) as sys declare function IupLabel(char* arg1) as sys declare function IupMainLoop() as sys declare function IupClose() end extern IupOpen(null,null) IupShow(IupDialog(IupLabel("Hello World!"))) IupMainLoop() IupClose()
|
|
|
Post by Pjot on Dec 7, 2012 12:06:32 GMT 1
Those options now can be defined in your code as follows: PRAGMA OPTIONS -I/usr/include/iup PRAGMA INCLUDE iup/iup.h PRAGMA LDFLAGS iup
Now a compile with simply 'bacon iup_demo' should work... use the latest beta to test. BR, Peter
|
|
|
Post by bigbass on Dec 7, 2012 16:46:53 GMT 1
Hey jrs thanks for the example code ! This is jrs' first example before we had the new bacon options PROTO IupOpen, IupShow, IupDialog, IupLabel, IupMainLoop, IupClose
IupOpen(NULL,NULL) IupShow(IupDialog(IupLabel("Hello World!"))) IupMainLoop() IupClose() ============================================= UPDATED *Peter kindly just added code to the bacon compiler so we can now do this instead I came in the middle of the conversation so here is how to combine both ideas in the simple example given by jrs helloiup.bac in the first post helloiup2.bac now with Peter's latest bacon compiler options using a new option called PRAGMA that allows you to add the compiler options to the header of your code to permit the simple command line we like about bacon Of course we need a simple demo code example( for the non gurus like me ) to get a grip of what's going on and this may help someone else getting started quickly *if I can figure this out I will help with simple widget code examples too I use slackware 14 with the xfce desktop so your image will differ Joe compile with just bacon helloiup2.bac save this as helloiup2.bac PRAGMA OPTIONS -I/usr/include/iup PRAGMA INCLUDE iup/iup.h PRAGMA LDFLAGS iup PROTO IupOpen, IupShow, IupDialog, IupLabel, IupMainLoop, IupClose
IupOpen(NULL,NULL) IupShow(IupDialog(IupLabel("Hello World!"))) IupMainLoop() IupClose()
Notes : The PROTO option is quite interesting *the first time I got a chance to use this command in action using the above example code you can easily see it like IMPORT .Only the functions we will use get compiled to make for a smaller binary (efficient code )
|
|
|
Post by bigbass on Dec 7, 2012 18:46:40 GMT 1
Thanks jrs ! Thanks Peter! I Think I will be able to convert this (and the other examples ) to BaCon following jrs' script basic example I got it to compile in BaCon ;D Joe Name this alarm2.bacand compile like this bacon alarm2.bac PRAGMA OPTIONS -I/usr/include/iup PRAGMA INCLUDE iup/iup.h PRAGMA LDFLAGS iup PROTO IupOpen, IupClose, IupMessage ,IupAlarm
' Initializes IUP IupOpen(NULL,NULL)
' Executes IupAlarm response = IupAlarm ("IupAlarm Example", "File not saved! Save it now?", "Yes", "No", "Cancel")
' Shows a message for each selected button IF response = 1 THEN IupMessage ("Save file", "File saved successfully - leaving program") IF response = 2 THEN IupMessage ("Save file", "File not saved - leaving program anyway") IF response = 3 THEN IupMessage ("Save file", "Operation canceled") PRINT " Let's add a Bacon command " PRINT " Imagine that get output to the terminal " ' Finishes IUP IupClose() ' Program finished successfully END
added the PRINT command so you can see we can use BaCon
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 7, 2012 18:58:05 GMT 1
Be aware when using the SB examples that I hide some things and present them differently in my wrapper of IUP so the interface is more like a standard SB function call.
Example: I don't require a ending NULL to terminate a variable argument list. In the SB extension module interface I know how many arguments are being passed.
Glad to see you having fun with IUP.
|
|