FLTK-C-1.3.3 for FreeBASIC

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
angros47
Posts: 1923
Joined: Jun 21, 2005 19:04

Re: FLTK-C-1.3.3 for FreeBASIC

Postby angros47 » Mar 29, 2020 20:19

Just my curiosity.... but in case of FLTK, what prevents from using it directly from FreeBasic, without a C wrapper? I had a look at the include files, they seem normal class (and I know FreeBasic is compatible with C++ at least at ABI level)
robert
Posts: 161
Joined: Aug 06, 2019 18:45

Re: FLTK-C-1.3.3 for FreeBASIC

Postby robert » Apr 03, 2020 19:45

Typo fixed.
Last edited by robert on Apr 16, 2020 8:05, edited 1 time in total.
systemctl
Posts: 182
Joined: Mar 27, 2020 5:15

Re: FLTK-C-1.3.3 for FreeBASIC

Postby systemctl » Apr 16, 2020 7:07

The current version of FLTK is 1.3.5. Could you update your binding to this version?
Kwabbernoot
Posts: 77
Joined: Apr 19, 2010 18:23
Location: NL

Re: FLTK-C-1.3.3 for FreeBASIC

Postby Kwabbernoot » May 21, 2020 19:28

The following functions exist:
Fl_WindowNew
Fl_WindowExNew
Fl_BoxNew
Fl_BoxExNew
Fl_ButtonNew
Fl_ButtonExNew

What is the difference between the functions with "Ex" and without "Ex"?
Kwabbernoot
Posts: 77
Joined: Apr 19, 2010 18:23
Location: NL

Re: FLTK-C-1.3.3 for FreeBASIC

Postby Kwabbernoot » Aug 27, 2021 11:57

I've written a FLTK program for printing.
Some remarks.
1) After a Fl_PrinterSetCurrent you can't write anything to the screen anymore. For instance: Fl-WidgetCopyLabel won't work. After executing Fl_PrinterEndJob you can write to the screen again.

2) You can't write empty lines to the printer, you must have a line with at least one space.

3) There is a Fl_PrinterGetMargins, but there is no Fl_PrinterSetMargins.
What I wanted, was a small left margin. So I tried a negative column number (the x argument of DrawString). To my surprise, it works ! So you can work with a small left margin by specifying a negative x-value in DrawString.
jevans4949
Posts: 1168
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FLTK-C-1.3.3 for FreeBASIC

Postby jevans4949 » Oct 10, 2021 20:02

Can somebody advise me?

I have written a process for a long file (the UK postcode CSV file) within a FLTK program. To reassure that it's still running I am trying to put in a progress "meter", to show the value of the file record I'm processing. I've tried using an fl_output field, but the display doesn't update until the process completes. Is there some widget type I can use which will update the display without control being returned to the screen handler?
D.J.Peters
Posts: 8336
Joined: May 28, 2005 3:28
Contact:

Re: FLTK-C-1.3.3 for FreeBASIC

Postby D.J.Peters » Oct 10, 2021 20:38

@jevans4949
There are Fl_Progress01.bas shows you how to use a timeout handler as parallel task !
There are Timesharing01.bas shows you how to do an heavy task in background !
There are Fl_Wait02.bas shows you how do you control the event loop manually !

post a short example with equal problem I will try to help

Joshy
jevans4949
Posts: 1168
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FLTK-C-1.3.3 for FreeBASIC

Postby jevans4949 » Oct 10, 2021 20:52

Thanks, I will look ai these.
D.J.Peters
Posts: 8336
Joined: May 28, 2005 3:28
Contact:

Re: FLTK-C-1.3.3 for FreeBASIC

Postby D.J.Peters » Oct 10, 2021 21:21

@Kwabbernoot

you can print a complete window with Fl_PrinterPrintWindow()

Code: Select all

var prt = Fl_PrinterNew()
Fl_PrinterStartJob(prt,1)
Fl_PrinterStartPage(prt)
Fl_PrinterPrintWindow prt,win
Fl_PrinterEndPage prt
Fl_PrinterDelete prt
or print a widget with Fl_PrinterPrintWidget()

Code: Select all

var prt = Fl_PrinterNew()
Fl_PrinterStartJob(prt,1)
Fl_PrinterStartPage(prt)
Fl_PrinterPrintWidget prt,wgt
Fl_PrinterEndPage prt
Fl_PrinterDelete prt
or you can draw on the printer with Fl_PrinterSetCurrent()

Code: Select all

var prt = Fl_PrinterNew()
Fl_PrinterStartJob(prt,1)
Fl_PrinterStartPage(prt)
Fl_PrinterSetCurrent prt
DrawLine Circle, Text etc.
....
Fl_PrinterEndPage prt
Fl_PrinterEndJob prt
Fl_PrinterDelete prt
Remember there are Fl_PrinterSetCurrent() and Fl_WindowMakeCurrent()

If you make the printer the current target of commands with Fl_PrinterSetCurrent()
after printing you can/must make a window as new current target (if needed) with Fl_WindowMakeCurrent() !

Joshy
jevans4949
Posts: 1168
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FLTK-C-1.3.3 for FreeBASIC

Postby jevans4949 » Oct 17, 2021 19:56

I solved my problem of displaying progess in file processing simply by adding an fl_wait() after updating my main display, with the "outward" part of the postcode when it changed. Valuable to get an indication of progress when you're processing 30 million records. Next test, check I can get Shetland (postcode ZE).
D.J.Peters
Posts: 8336
Joined: May 28, 2005 3:28
Contact:

Re: FLTK-C-1.3.3 for FreeBASIC

Postby D.J.Peters » Oct 17, 2021 21:42

jevans4949 wrote:I solved my problem of displaying progess in file processing simply by adding an fl_wait() after updating my main display
So you create the GUI and enters the message loop with Fl_Run() and inside your processing stuff you call Fl_Wait() right ?

Joshy
jevans4949
Posts: 1168
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FLTK-C-1.3.3 for FreeBASIC

Postby jevans4949 » Oct 17, 2021 22:09

D.J.Peters wrote:
jevans4949 wrote:I solved my problem of displaying progess in file processing simply by adding an fl_wait() after updating my main display
So you create the GUI and enters the message loop with Fl_Run() and inside your processing stuff you call Fl_Wait() right ?

Joshy

Yes. The FLTK bit is used to select the input and output files and the parameters for the record selection. The file processing is fairly boring, and on change of postcode I update the display with corrent record key, then do a wait. I will probably enhance this to show numberof records read / written.

The aim is to select records for your town to make a file small enough to process with a spreadsheet program.

Unlke zip codes, UK postcodes are alphanumeric. A full list of all codes is available in CSV format free to charities and business startups once a quarter. See [url]poweredbypaf.com[/url] for information.

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest