FLTK-C-1.3.3 for FreeBASIC
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
And i personally have only a few areas of interest. Like graphics with Cairo and others, Fltk-c or few projects from Joshy, our hardworking translator. In most threads you will never see me, just not interested. :-)
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Here is another window draft with fbc-options:
Code: Select all
' fbc_options.bas
' by Knatterton
#include once "fltk-c.bi"
type toptions
as string opt, para, desc, value
end type
dim as toptions fbc_opt(60)
for i as short = 0 to 60
with fbc_opt(i)
read (.opt)
read (.para)
read (.desc)
end with
next i
data "","<file>","Read more command line arguments from a file", _
" -a","<file>","Treat file as .o/.a input file", _
" -arch","arch","Set target architecture (default: 486)", _
" -asm","att|intel","Set asm format (-gen gcc|llvm, x86 or x86_64 only)", _
" -b","<file>","Treat file as .bas input file", _
" -c","","Compile only, do not link", _
" -C","","Preserve temporary .o files", _
" -d","<name>[=<val>]","Add a global #define", _
" -dll","","Same as -dylib", _
" -dylib","","Create a DLL (win32) or shared library (*nix/*BSD)", _
" -e","","Enable runtime error checking", _
" -ex","","-e plus RESUME support", _
" -exx","","-ex plus array bounds/null-pointer checking", _
" -export","","Export symbols for dynamic linkage", _
" -forcelang","<name>","Override #lang statements in source code", _
" -fpmode","fast|precise","Select floating-point math accuracy/speed", _
" -fpu","x87|sse","Set target FPU", _
" -g","","Add debug info", _
" -gen","gas|gcc|llvm","Select code generation backend", _
"[-]-help","","Show this help output", _
" -i","<path>","Add an include file search path", _
" -include","<file>","Pre-#include a file for each input .bas", _
" -l","<name>","Link in a library", _
" -lang","lang","Select FB dialect: fb, deprecated, fblite, qb", _
" -lib","","Create a static library", _
" -m","<name>","Specify main module (default if not -c: first input .bas)", _
" -map","<file>","Save linking map to file", _
" -maxerr","<n>","Only show <n> errors", _
" -mt","","Use thread-safe FB runtime", _
" -nodeflibs","","Do not include the default libraries", _
" -noerrline","","Do not show source context in error messages", _
" -noobjinfo","","Do not read/write compile-time info from/to .o and .a files", _
" -o","<file>","Set .o (or -pp .bas) file name for prev/next input file", _
" -O","<value>","Optimization level (default: 0)", _
" -p","<path>","Add a library search path", _
" -pic","","Generate position-independent code (non-x86 Unix shared libs)", _
" -pp","","Write out preprocessed input file (.pp.bas) only", _
" -prefix","<path>","Set the compiler prefix path", _
" -print","host|target","Display host/target system name", _
" -print","fblibdir","Display the compiler's lib/ path", _
" -print","x","Display output binary/library file name (if known)", _
" -profile","","Enable function profiling", _
" -r","","Write out .asm/.c/.ll (-gen gas/gcc/llvm) only", _
" -rr","","Write out the final .asm only", _
" -R","","Preserve temporary .asm/.c/.ll/.def files", _
" -RR","","Preserve the final .asm file", _
" -s","console|gui","Select win32 subsystem", _
" -showincludes","","Display a tree of file names of #included files", _
" -static","","Prefer static libraries over dynamic ones when linking", _
" -t","<value>","Set .exe stack size in kbytes, default: 1024 (win32/dos)", _
" -target","<name>","Set cross-compilation target", _
" -title","<name>","Set XBE display title (xbox)", _
" -v","","Be verbose", _
" -vec","<n>","Automatic vectorization level (default: 0)", _
"[-]-version","","Show compiler version ", _
" -w","all|pedantic|<n>","Set min warning level: all, pedantic or a value", _
" -Wa","<a,b,c>","Pass options to 'as'", _
" -Wc","<a,b,c>","Pass options to 'gcc' (-gen gcc) or 'llc' (-gen llvm)", _
" -Wl","<a,b,c>","Pass options to 'ld'", _
" -x","<file>","Set output executable/library file name", _
" -z","setjmp","Use setjmp/longjmp to implement GOSUB"
sub ChoiceCB cdecl (byval self as Fl_Widget ptr,byval cho as any ptr)
' get parent of the widget
var win = Fl_WidgetWindow(self)
' get index of selected item
var ind = Fl_ChoiceGetValue(cho)
' copy label from item to window caption
' Fl_WindowCopyLabel win,Fl_Menu_GetMenu(cho)[ind].text
' print value
? *Fl_Menu_GetMenu(cho)[ind].text
end sub
sub CancelButtonCB cdecl (byval button as FL_WIDGET ptr)
'static var Pushed=1
'Fl_WidgetCopyLabel button,"push me:" & chr(10) & Pushed & " times pushed"
'Pushed+=1
end sub
sub OKButtonCB cdecl (byval button as FL_WIDGET ptr)
end sub
var win = Fl_WindowNew(860,640,"Fbc options")
var cancelbtn = Fl_ButtonNew(Fl_WidgetGetW(win)-180,Fl_WidgetGetH(win)-40,70,24,"Cancel")
var okbtn = Fl_ButtonNew(Fl_WidgetGetW(win)-90,Fl_WidgetGetH(win)-40,70,24,"OK")
Fl_WidgetSetCallback0 cancelbtn,@CancelButtonCB
Fl_WidgetSetCallback0 okbtn,@OKButtonCB
var scr = Fl_ScrollNew(20,20,Fl_WidgetGetW(win)-40,Fl_WidgetGetH(win)-80)
' get the V Scrollbar
var v = Fl_ScrollScrollbar(scr)
Fl_WidgetSetAlign v,Fl_ALIGN_BOTTOM_RIGHT ' <-- default
dim as Fl_Check_Button ptr cb(60)
dim as Fl_Button ptr btn(60)
' create the lines
for i as short = 0 to 60
with fbc_opt(i)
cb(i) = Fl_Check_ButtonNew(20,i*20+20,20,10, .opt)
var fl_boxn = Fl_BoxNew(300,i*20+20,500,20, .desc)
Fl_WidgetSetAlign *fl_boxn,Fl_ALIGN_LEFT or Fl_ALIGN_INSIDE
select case .para
case "<file>"
btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case "<value>"
btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case "<path>"
btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case "<name>"
btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case "<n>"
btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case ""
' btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
case "arch"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"native")
Fl_Menu_Add3(cho,"32")
Fl_Menu_Add3(cho, "64")
Fl_Menu_Add3(cho,"386")
Fl_Menu_Add3(cho,"486")
Fl_Menu_Add3(cho,"586")
Fl_Menu_Add3(cho,"686")
Fl_Menu_Add3(cho,"athlon")
Fl_Menu_Add3(cho,"athlon-xp")
Fl_Menu_Add3(cho,"athlon-fx")
Fl_Menu_Add3(cho,"k8-")
Fl_Menu_Add3(cho,"pentium-mmx")
Fl_Menu_Add3(cho,"pentium2")
Fl_Menu_Add3(cho,"pentium3")
Fl_Menu_Add3(cho,"pentium4")
Fl_Menu_Add3(cho,"pentium4-sse3")
Fl_Menu_Add3(cho,"x86_64")
Fl_Menu_Add3(cho,"x86-64")
Fl_Menu_Add3(cho,"amd64")
Fl_Menu_Add3(cho,"armv6")
Fl_Menu_Add3(cho,"armv7-a")
Fl_Menu_Add3(cho,"aarch64")
Fl_ChoiceSetValue(cho,0)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "lang"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"fb")
Fl_Menu_Add3(cho,"deprecated")
Fl_Menu_Add3(cho,"fblite")
Fl_Menu_Add3(cho,"qb")
Fl_ChoiceSetValue(cho,0)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "att|intel"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"att")
Fl_Menu_Add3(cho,"intel")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "fast|precise"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"fast")
Fl_Menu_Add3(cho,"precise")
Fl_ChoiceSetValue(cho,0)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "x87|sse"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"x87")
Fl_Menu_Add3(cho,"sse")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "gas|gcc|llvm"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"gas")
Fl_Menu_Add3(cho,"gcc")
Fl_Menu_Add3(cho,"llmv")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "host|target"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"host")
Fl_Menu_Add3(cho,"target")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "console|gui"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"console")
Fl_Menu_Add3(cho,"gui")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "all|pedantic|<n>"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"all")
Fl_Menu_Add3(cho,"none")
Fl_Menu_Add3(cho,"pedantic")
Fl_Menu_Add3(cho,"param")
Fl_Menu_Add3(cho,"Escape")
Fl_Menu_Add3(cho,"Next")
Fl_Menu_Add3(cho,"funcptr")
Fl_Menu_Add3(cho,"constness")
' Fl_Menu_Add3(cho,"W0")
Fl_ChoiceSetValue(cho,1)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "setjmp"
var cho = Fl_ChoiceNew(160,i*20+20,140,20,"")
Fl_Menu_Add3(cho,"setjmp")
Fl_Menu_Add3(cho,"gosub")
Fl_ChoiceSetValue(cho,0)
Fl_WidgetSetCallbackArg cho,@ChoiceCB,cho
case "<a,b,c>"
case else
' btn(i) = Fl_ButtonNew(160,i*20+20,140,20,.para)
end select
end with
next
Fl_ScrollScrollTo scr, 0,0
Fl_GroupSetResizable win,scr
Fl_WindowShow win
Fl_Run
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
I myself am using Geany all the time with the cmd-line
at the moment and seldom need other options.
The idea would be to take the options window into "FastLighter.bas" and open the .bas files each in a new tab like in "Fl_Tabs03.bas" with syntax highlighting like in "Fl_text_3.bas".
In the options window i would put all activated options along with their parameters in the global array (which Joshy and MrSwiss dislike). If the OK-Button is pressed i would loop through this array and construct the complete cmd-line. Then execute this and compile the active .bas file. But i don't know how to do it in oop style.
Code: Select all
fbc -w all -gen gcc -O 2 fbc_options_10.bas
The idea would be to take the options window into "FastLighter.bas" and open the .bas files each in a new tab like in "Fl_Tabs03.bas" with syntax highlighting like in "Fl_text_3.bas".
In the options window i would put all activated options along with their parameters in the global array (which Joshy and MrSwiss dislike). If the OK-Button is pressed i would loop through this array and construct the complete cmd-line. Then execute this and compile the active .bas file. But i don't know how to do it in oop style.
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Sorry writing so much here when obviously nobody is interested. Just want to finish this idea.
You know almost all about about fltk-c, Joshy. But an beginner does not. That's why they often become stuck in a later point of their project. Mostly simple things like closing a window can drive you mad and it takes days, because it is mentioned nowhere.
That's what complex example programs good for. Means, a progam where most of the features in the example snippets put together to form a complete program. This could be used as a base for a step-by-step tutorial. So i think it would be a really good idea to create a complete IDE with fltk-c and ship this together with next version.
Many people have their own windows-only IDE in this forum. What's so special in "ours"? It's platform independent. :-)
You know almost all about about fltk-c, Joshy. But an beginner does not. That's why they often become stuck in a later point of their project. Mostly simple things like closing a window can drive you mad and it takes days, because it is mentioned nowhere.
That's what complex example programs good for. Means, a progam where most of the features in the example snippets put together to form a complete program. This could be used as a base for a step-by-step tutorial. So i think it would be a really good idea to create a complete IDE with fltk-c and ship this together with next version.
Many people have their own windows-only IDE in this forum. What's so special in "ours"? It's platform independent. :-)
Re: FLTK-C-1.3.3 for FreeBASIC
Not sure if this is a question or remark, but in my code containing a main window and setting window, I just use the small 'x' (often top-left) of the window manager :-)Knatterton wrote:... Mostly simple things like closing a window can drive you mad and it takes days, because it is mentioned nowhere..
More serious, in main I call ounce:
Code: Select all
_guiLaunch()
Code: Select all
sub _guiLaunch()
_guiMainDef(1) '1 = show
_guiSetDef(0)
Fl_Run
end sub
Code: Select all
sub _guiSetDef(show as integer)
pWinSet = Fl_WindowNew(...)
'other code...
if (show = 1) then Fl_WindowShow(pWinSet)
end sub
Code: Select all
sub _guiMainDef(show as integer)
pWinMain = Fl_WindowNew(...)
Fl_WidgetSetCallback0(pWinMain, @guiCloseMain)
'other code...
if (show = 1) then Fl_WindowShow(pWinMain)
end sub
Code: Select all
sub guiCloseMain cdecl (byval widget as Fl_Widget ptr)
'close all windows
var win = Fl_GetFirstWindow()
while win
Fl_WindowHide win
win = Fl_GetFirstWindow()
wend
end sub
Also, I have all FLTK widgets global (shared). I did not know to do that differently at that time.
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Both.badidea wrote:Not sure if this is a question or remark,
The project Fltk-c for FB started in another thread before in Aug 26, 2013 that reached about 50 pages:
https://freebasic.net/forum/viewtopic.php?f=14&t=21548
And now it has 18 pages. But how many people created complete, useful programs with it in these six years and where we can download them?
Re: FLTK-C-1.3.3 for FreeBASIC
I have already mentioned my calculator program:
https://freebasic.net/forum/viewtopic.p ... 87#p208187
I have other programs written with FLTK but they are all french versions so I have to modifiy them.
And BTW, yes I use global variables :)
https://freebasic.net/forum/viewtopic.p ... 87#p208187
I have other programs written with FLTK but they are all french versions so I have to modifiy them.
And BTW, yes I use global variables :)
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Great job!jdebord wrote:I have already mentioned my calculator program:
https://freebasic.net/forum/viewtopic.p ... 87#p208187
I have other programs written with FLTK but they are all french versions so I have to modifiy them.
And BTW, yes I use global variables :)
Have just compiled it in Linux Mint 19.2 with FB 1.06.
At "fbc -dll fbeval.bas" i got the error "redefinition of intrinsic", so commented out these two lines:
Code: Select all
'#define True -1
'#define False 0
Re: FLTK-C-1.3.3 for FreeBASIC
Glad to see that it works :)
And yes, TRUE and FALSE are already defined in the most recent FB versions.
And yes, TRUE and FALSE are already defined in the most recent FB versions.
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Interesting demonstration for the usage of dynamic libs.
Although i myself only use +, -, * and / and can't test the other functions. :-)
Although i myself only use +, -, * and / and can't test the other functions. :-)
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Another small improvement:These two programs are meant for users that are searching for toolbar or imagebutton examples. It' s the code from "Fl_File_Icon02.bas" slightly changed and with more speaking names:
These could be included in next version.
Code: Select all
' Fltk_Toolbar01.bas
#include once "fltk-c.bi"
' You can use the Fl_File_Icon class as "normal" icons also.
' test of
' Fl_File_IconNew
' Fl_File_IconLoad
const ICONSIZE = 48' try 8,16,24,32 also
sub ButtonCB cdecl (byval button as FL_WIDGET ptr)
? "Button pushed"
end sub
'
' main
'
Fl_Register_Images
Fl_File_IconLoadSystemIcons
var Icon01 = Fl_File_IconNew() : Fl_File_IconLoad Icon01,"media/new-2_32x32.png"
var Icon02 = Fl_File_IconNew() : Fl_File_IconLoad Icon02,"media/open-2_24x24.png"
var Icon03 = Fl_File_IconNew() : Fl_File_IconLoad Icon03,"media/open-2_32x32.png"
var Icon04 = Fl_File_IconNew() : Fl_File_IconLoad Icon04,"media/open-recent-2_24x24.png"
var Icon05 = Fl_File_IconNew() : Fl_File_IconLoad Icon05,"media/open-recent-2_32x32.png"
var Icon06 = Fl_File_IconNew() : Fl_File_IconLoad Icon06,"media/properties-2_24x24.png"
var Icon07 = Fl_File_IconNew() : Fl_File_IconLoad Icon07,"media/renata.png"
var Icon08 = Fl_File_IconNew() : Fl_File_IconLoad Icon08,"media/accessories-calculator-3_48x48.png"
var Icon09 = Fl_File_IconNew() : Fl_File_IconLoad Icon09,"media/save-2_24x24.png"
var Icon10 = Fl_File_IconNew() : Fl_File_IconLoad Icon10,"media/application-exit-4_32x32.png"
var Icon11 = Fl_File_IconNew() : Fl_File_IconLoad Icon11,"media/save-2_32x32.png"
var Icon12 = Fl_File_IconNew() : Fl_File_IconLoad Icon12,"media/close-2_24x24.png"
var Icon13 = Fl_File_IconNew() : Fl_File_IconLoad Icon13,"media/save-all_24x24.png"
var Icon14 = Fl_File_IconNew() : Fl_File_IconLoad Icon14,"media/exit-2_24x24.png"
var Icon15 = Fl_File_IconNew() : Fl_File_IconLoad Icon15,"media/save-as-2_24x24.png"
var Icon16 = Fl_File_IconNew() : Fl_File_IconLoad Icon16,"media/exit-2_32x32.png"
var Icon17 = Fl_File_IconNew() : Fl_File_IconLoad Icon17,"media/save-as-2_32x32.png"
var Icon18 = Fl_File_IconNew() : Fl_File_IconLoad Icon18,"media/lin.png"
var Icon19 = Fl_File_IconNew() : Fl_File_IconLoad Icon19,"media/win.png"
var Icon20 = Fl_File_IconNew() : Fl_File_IconLoad Icon20,"media/new-2_24x24.png"
var win = Fl_Double_WindowNew(1024,480,"Fltk_Toolbar01.bas")
var toolbar = Fl_GroupNew(0,0,Fl_WidgetGetW(win),ICONSIZE)
Fl_WidgetSetBox toolbar,Boxtype(FL_UP_BOX)
' create buttons
var btn01 = Fl_ButtonNew(0*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon01,btn01
var btn02 = Fl_ButtonNew(1*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon02,btn02
var btn03 = Fl_ButtonNew(2*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon03,btn03
var btn04 = Fl_ButtonNew(3*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon04,btn04
var btn05 = Fl_ButtonNew(4*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon05,btn05
var btn06 = Fl_ButtonNew(5*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon06,btn06
var btn07 = Fl_ButtonNew(6*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon07,btn07
var btn08 = Fl_ButtonNew(7*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon08,btn08
var btn09 = Fl_ButtonNew(8*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon09,btn09
var btn10 = Fl_ButtonNew(9*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon10,btn10
var btn11 = Fl_ButtonNew(10*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon11,btn11
var btn12 = Fl_ButtonNew(11*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon12,btn12
var btn13 = Fl_ButtonNew(12*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon13,btn13
var btn14 = Fl_ButtonNew(13*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon14,btn14
var btn15 = Fl_ButtonNew(14*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon15,btn15
var btn16 = Fl_ButtonNew(15*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon16,btn16
var btn17 = Fl_ButtonNew(16*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon17,btn17
var btn18 = Fl_ButtonNew(17*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon18,btn18
var btn19 = Fl_ButtonNew(18*ICONSIZE,1,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon19,btn19
var btn20 = Fl_ButtonNew(19*ICONSIZE,0,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon20,btn20
' connect callbacks
Fl_WidgetSetCallback0 btn01,@ButtonCB
Fl_WidgetSetCallback0 btn02,@ButtonCB
Fl_WidgetSetCallback0 btn03,@ButtonCB
Fl_WidgetSetCallback0 btn04,@ButtonCB
Fl_WidgetSetCallback0 btn05,@ButtonCB
Fl_WidgetSetCallback0 btn06,@ButtonCB
Fl_WidgetSetCallback0 btn07,@ButtonCB
Fl_WidgetSetCallback0 btn08,@ButtonCB
Fl_WidgetSetCallback0 btn09,@ButtonCB
Fl_WidgetSetCallback0 btn10,@ButtonCB
Fl_WidgetSetCallback0 btn11,@ButtonCB
Fl_WidgetSetCallback0 btn12,@ButtonCB
Fl_WidgetSetCallback0 btn13,@ButtonCB
Fl_WidgetSetCallback0 btn14,@ButtonCB
Fl_WidgetSetCallback0 btn15,@ButtonCB
Fl_WidgetSetCallback0 btn16,@ButtonCB
Fl_WidgetSetCallback0 btn17,@ButtonCB
Fl_WidgetSetCallback0 btn18,@ButtonCB
Fl_WidgetSetCallback0 btn19,@ButtonCB
Fl_WidgetSetCallback0 btn20,@ButtonCB
Fl_GroupEnd toolbar
FL_WindowEnd win
Fl_WindowResizeable win,toolbar
Fl_WindowShow win
Fl_Run
Code: Select all
' Fltk_Imagebutton01.bas
#include once "fltk-c.bi"
' You can use the Fl_File_Icon class as "normal" icons also.
' test of
' Fl_File_IconNew
' Fl_File_IconLoad
const ICONSIZE = 48' try 8,16,24,32 also
sub ButtonCB cdecl (byval button as FL_WIDGET ptr)
? "Button pushed"
end sub
'
' main
'
Fl_Register_Images
Fl_File_IconLoadSystemIcons
var Icon18 = Fl_File_IconNew() : Fl_File_IconLoad Icon18,"media/lin.png"
var Icon19 = Fl_File_IconNew() : Fl_File_IconLoad Icon19,"media/win.png"
var win = Fl_Double_WindowNew(320,200,"Fltk_Imagebutton01.bas")
var btn1 = Fl_ButtonNew(90,80,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon18,btn1
var btn2 = Fl_ButtonNew(180,80,ICONSIZE,ICONSIZE):Fl_File_IconLabel Icon19,btn2
' connect callbacks
Fl_WidgetSetCallback0 btn1, @ButtonCB
Fl_WidgetSetCallback0 btn2, @ButtonCB
FL_WindowEnd win
Fl_WindowShow win
Fl_Run
-
- Posts: 556
- Joined: Mar 10, 2007 15:44
- Location: Ohio, USA
- Contact:
Re: FLTK-C-1.3.3 for FreeBASIC
I understand that I can use Fl_WindowExSetHandleCB to trap window events.
If I trap for the FL_EVENT_SHOW, is this run before or after the call to Fl_Run.
I would like to run a little init code that might create another window, other than the main.
If I trap for the FL_EVENT_SHOW, is this run before or after the call to Fl_Run.
I would like to run a little init code that might create another window, other than the main.
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
I would say, fltk has all to create a complete program. With a little polish and system it should be possible. To distinguish the Fl_Objects examples from self-created their filenames could begin with "Fltk_", so you always know what type of file this is. Like i do with the Cairo_ examples. This saves lots of time with many files. Similar with filenames like "drawing06.bas". "Fltk_draw_timer.bas" is much more speaking and saves a lot of searching time.
If Fltk would be my project i would be pleased when others are creating complete programs with it. But Joshy seems not to be interested.
If Fltk would be my project i would be pleased when others are creating complete programs with it. But Joshy seems not to be interested.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK-C-1.3.3 for FreeBASIC
Do you know how many code I wrote or translated for the FreeBASIC community since last 14 years !Knatterton wrote:But Joshy seems not to be interested.
Currently I build the include files for XAUDIO2 (differs for Windows 7,8,10)
I write and cross compile the C++ wrapper and create new include files for latest version of the React 3D physics library (win32/64 Linux32/64)
I write and compile C++ wrapper and create new include files for the Milkshape 3D editor (win32 only)
...
It's up to you all to support all the hard work I made
test all stuff find and report errors
write programs
write help files
...
By the way all the *.bas files I wrote in the fltk-c-1.1.3 folder are not really examples for you users.
It's more a test if I added a command to the C++ wrapper and was not sure does it will work as accepted.
For example no once test all gfx commands and reports any problems they are 2,600 fltk-c commands waiting for testing ;-)
Again you are all free to support fltk-c, happy GUI coding.
Joshy
Last edited by D.J.Peters on Jul 21, 2019 17:39, edited 1 time in total.
-
- Posts: 165
- Joined: Apr 19, 2019 19:03
Re: FLTK-C-1.3.3 for FreeBASIC
Yes, i have already started a few files, i will post them when ready.D.J.Peters wrote: test all stuff find and report errors
write programs
write help files