recent discussions about GUI lib's led me to investgate them.
The knock out criteria set by myself are the following:
- cross OS compatible (no OS dependency)
- straight C interface (no wrappers for C++ needed)
- available as precompiled binaries (not just source)
- FB headers already existing (.bi files) even if not necessarily up-to-date
- simple installation (preferably with static linking)
- simple syntax (easy to get aquainted with)
- DPI awareness (Win only, I think)
- simple examples (in doc or elsewhere) for easy translation to FB
- possibilty to handle plots (for scientific/technical use)
which seems to be the only one, that covers all the preset knock out criteria above.
Plus, just about all my nice to have's, as well.
Just so much about why IUP (you might have other criteria to lead you elsewhere).
Getting started (Win installation/Lin is different):
- 1) getting the binaries (which isn't that clearly described)
link: at sourceforge choose: iup-3.28_Win64_mingw6_lib.zip -- or -- iup-3.28_Win32_mingw6_lib.zip
2) unzip the files to a freshly created directory/folder
3) optional: (I don't like empty dir's on my storage) delete empty dir's
4) copy all .a files to your FBC installation: <FBC>/lib
5) all done ... time for first tests
IUP_ex1mod.bas -- a bit modified by myself:
Code: Select all
' IUP_ex1mod.bas -- (c) 2020-05-04, MrSwiss
'
' compile: -s gui
'
#Include "IUP/iup.bi" ' static lib's ver. 3.28 (.bi is for 3.15)
' it is still working "as expected" _
' maybe without the latest additions
Dim As UByte bits = SizeOf(Any Ptr) * 8 ' get FBC's bitness w/o preprocessor
Dim As String msg1 = "Hello FreeBASIC programmers from IUP 3.28" + Chr(10) + _
"FB-IUP bindings 3.15 and FBC" + Str(bits) + " ver. " + _
__FB_VERSION__, _
title1 = "FBC + IUP -- Example 1 (modified)"
IupOpen(0, 0) ' required
IupMessage(title1, msg1) ' waits for 'OK' button click
IupClose() ' required
' ----- EOF -----
Code: Select all
' IUP_ex2.bas -- (c) 2020-05-06, MrSwiss
'
' compile: -s gui
'
#Include "IUP/iup.bi" ' LINUX only: insists on propper case
' ===== Main =====
Dim As Ihandle Ptr dlg, label
IupOpen(0, 0)
label = IupLabel("Hello world from IUP.")
dlg = IupDialog(IupVbox(label, 0))
IupSetAttribute(dlg, "TITLE", "Hello World 2")
IupShowXY(dlg, IUP_CENTER, IUP_CENTER)
IupMainLoop()
IupClose()
' ===== End Main ===== ' ----- EOF -----
Code: Select all
' IUP_ex5.bas -- (c) 2020-05-06, MrSwiss
'
' compile: -s gui
'
#Include "IUP/iup.bi" ' LINUX only: insists on propper case
Function btn_exit_cb() As Long
Return IUP_CLOSE
End Function
' ===== Main =====
Dim As Ihandle Ptr dlg, button, label, vbox
IupOpen(0, 0)
label = IupLabel("Hello world from IUP.")
button = IupButton("OK", 0)
vbox = IupVbox(label, button, 0)
IupSetAttribute(vbox, "ALIGNMENT", "ACENTER")
IupSetAttribute(vbox, "GAP", "10")
IupSetAttribute(vbox, "MARGIN", "10x10")
dlg = IupDialog(vbox)
IupSetAttribute(dlg, "TITLE", "Hello World 5")
IupSetCallback(button, "ACTION", Cast(Icallback, @btn_exit_cb))
IupShowXY(dlg, IUP_CENTER, IUP_CENTER)
IupMainLoop()
IupClose()
' ===== End Main ===== ' ----- EOF -----
There only purpose is: to test whether the install was successfull.
[Edit] 2020-05-06 CEST 23.23.23 (updated code) removed typo[/Edit]