|
Post by vovchik on Jun 10, 2018 17:00:34 GMT 1
Dear Joe, Welcome back in full force (i.e. with a machine running Linux) and thanks for that clear example. I included that progress bar into hug-fltk a while back and it seems to work, too. I now have to compare how we did things. With kind regards, vovchik
|
|
|
Post by bigbass on Jun 27, 2018 5:54:30 GMT 1
Hey vovchik Keeping with the events idea fltk doesn't work like HUG or gtk so to compare events hug version of this code sorting out events is much easier with our working fltk examples I wrote this in fluid to get the GUI placement than ported to bacon 'multi-check.bac
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Window.H> PRAGMA INCLUDE <FL/Fl_Check_Button.H> PRAGMA INCLUDE <FL/Fl_Button.H> PRAGMA INCLUDE <FL/Fl_Multi_Browser.H> PRAGMA LDFLAGS -lfltk -L. PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-permissive
OPTION PARSE FALSE
DECLARE WIN TYPE Fl_Window* DECLARE My_checkbox , My_checkbox1 , My_checkbox2 TYPE Fl_Check_Button* DECLARE My_checkbox3 , My_checkbox4 , My_checkbox5 TYPE Fl_Check_Button* DECLARE My_ok TYPE Fl_Button* DECLARE My_Edit TYPE Fl_Multi_Browser*
'--- needed a dummy argument for the callback to work in bacon '--- replaced Fl_Text_Display with Fl_Multi_Browser it is easier to use
SUB checkbox_demo(Fl_Widget* dummy, void*) '--- clean terminal and Fl_Multi_Browser CLEAR My_Edit->clear() IF (int)My_checkbox->value() == 1 THEN My_Edit->add("Check1") END IF
IF (int)My_checkbox2->value() == 1 THEN My_Edit->add("Check2") END IF
IF (int)My_checkbox3->value() == 1 THEN My_Edit->add("Check3") END IF
IF (int)My_checkbox4->value() == 1 THEN My_Edit->add("Check4") END IF
IF (int)My_checkbox5->value() == 1 THEN My_Edit->add("Check5") END IF END SUB
WIN = new Fl_Window(465, 285, "Fluid multiple check") WIN->box(FL_GLEAM_UP_BOX) My_checkbox = new Fl_Check_Button(35, 70, 25, 25, "Check1") My_checkbox->down_box(FL_DOWN_BOX) 'My_checkbox->callback(checkbox_demo) My_checkbox2 = new Fl_Check_Button(35, 97, 25, 25, "Check2") My_checkbox2->down_box(FL_DOWN_BOX) 'My_checkbox2->callback(checkbox_demo) My_checkbox3 = new Fl_Check_Button(35, 125, 25, 25, "Check3") My_checkbox3->down_box(FL_DOWN_BOX) 'My_checkbox3->callback(checkbox_demo) My_checkbox4 = new Fl_Check_Button(35, 152, 25, 25, "Check4") My_checkbox4->down_box(FL_DOWN_BOX) 'My_checkbox4->callback(checkbox_demo) My_checkbox5 = new Fl_Check_Button(35, 180, 25, 25, "Check5") My_checkbox5->down_box(FL_DOWN_BOX) 'My_checkbox5->callback(checkbox_demo) My_ok = new Fl_Button(290, 225, 100, 25, "Get Results") My_ok->box(FL_GLEAM_UP_BOX) My_ok->callback(checkbox_demo) My_Edit = new Fl_Multi_Browser(180, 70, 215, 130) My_Edit ->box(FL_GLEAM_UP_BOX) WIN->show() Fl::run()
|
|
|
Post by vovchik on Jun 27, 2018 10:40:24 GMT 1
Dear Joe, It works. Thanks. But we could probably just use a box, since nothing is really going on in the edit window that would require the use of the complex multi_Browser widget (unless you are just playing with it in order to understand how it works). Here is a little hug-fltk example using a plain box. That multi_browser widget is rather powerful and full of features. I have played with it in various places and have to learn more (particularly formatting, positioning and finding data). With kind regards, vovchik PS. UPDATED - added a gratuitous image for bling and used TOKENs just for the sake of code golfing. Attachments:vov-multicheck.tar.gz (29.93 KB)
|
|
|
Post by bigbass on Jun 27, 2018 19:32:24 GMT 1
Hey vovchik Thanks for the fltk-hug example better with an array The multi_Browser is more complex And has more options for events that we need demo code for But it works better than the check browser I had problems with getting a decent example For the check broswer going www.fltk.org/doc-1.3/classFl__Check__Browser.htmlSeems broken with getting multiple selected lines or its my method thats broken It is an interestng widget so worth the work Joe
|
|
|
Post by vovchik on Jun 28, 2018 14:08:05 GMT 1
Dear all, Here is a little GUI wrapper (demo) for btonegen (a DTMF generator I just recently did). Compile both progs in the same directory and then run touchpad. Let me know whether it works for you. Btonegen also runs as a stand-alone command-line program with lots of options for generating sounds. Thanks. With kind regards, vovchik Attachments:
touchpad-src.tar.gz (28.26 KB)
|
|
|
Post by Pjot on Jun 28, 2018 20:27:38 GMT 1
Thanks vovchik,
Nicely done! I see you are using the good old Open Sound System (OSS) for Linux. To make this work on my Linux Mint 18.2 64bit, I had to install one more package called the OSS Proxy Daemon:
After this, I was able to run the 'btonegen' program which generates nice tones when providing the correct command line parameters.
For the 'touchpad' program, it did not work from the GUI (command line worked fine, though). To make it work in the GUI, I changed line 140 and 150 as follows:
SYSTEM DIRNAME$(ME$) & "/btonegen -a " & .......etc
This way, the GUI can find the 'btonegen' program in its directory.
Thanks again, Peter
|
|
|
Post by vovchik on Jun 28, 2018 20:54:58 GMT 1
Dear Peter, Thanks for the tips and testing. I have changed the source in the archive above (i.e. DIRNAME$) and also included the installation tip in the btonegen comments at the top. I quite like OSS, since it is not hard to program and, when the right modules are loaded, it works fine. And because the tone generator can handle "dual tones", we can produce all sorts of weird noises. With kind regards, vovchik
|
|
|
Post by bigbass on Jun 30, 2018 6:14:57 GMT 1
Hey guys Here is the Fl_CheckBrowser with a real package installer to do a quick BaCon development set up box because I used apt-get as the backend its safe if a package is already installed it will just say done! and no problems between 32/64 bit with this short list only for debian based systems tested on mint mate 19 '--- quick-bacon-setup.bac '--- The first demo of the multi Fl_Check_Browser in action by bigbass '--- demo for setting up a quick development box for BaCon
PRAGMA INCLUDE <FL/Fl.H> PRAGMA INCLUDE <FL/Fl_Double_Window.H> PRAGMA INCLUDE <FL/Fl_Check_Button.H> PRAGMA INCLUDE <FL/Fl_Button.H> PRAGMA INCLUDE <FL/Fl_Check_Browser.H> PRAGMA INCLUDE <FL/Fl_Multi_Browser.H> PRAGMA INCLUDE <FL/Fl_Output.H> PRAGMA LDFLAGS -lfltk -L. PRAGMA LDFLAGS -lbacon++ PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith -Wno-permissive OPTION PARSE FALSE
DECLARE WIN TYPE Fl_Double_Window* DECLARE My_ok TYPE Fl_Button* DECLARE My_Edit TYPE Fl_Multi_Browser* DECLARE OS_USED TYPE Fl_Output* DECLARE browser TYPE Fl_Check_Browser*
'--- needed a dummy argument for the callback to work in bacon '--- replaced Fl_Text_Display with Fl_Multi_Browser it has more options '================================================== SUB checkbox_demo(Fl_Widget* dummy, void* data) '================================================== '--- clean terminal and Fl_Multi_Browser CLEAR My_Edit->clear() LOCAL i TYPE int LOCAL selected$ TYPE STRING
FOR i = 1 TO 8
IF browser->checked(i) THEN selected$ = browser->text(i) My_Edit->add(selected$) PRINT selected$ SETENVIRON "result_selected",selected$ EXEC$("xterm -bg BLACK -fg WHITE -e sudo apt-get install \"$result_selected\"") END IF NEXT END SUB
WIN = new Fl_Double_Window(570, 285, "Quick Bacon development set up") WIN->box(FL_GLEAM_UP_BOX) WIN->color(28) WIN->selection_color(FL_BLACK) WIN->labelcolor(FL_BLACK) WIN->align(260)
browser = new Fl_Check_Browser(10, 40, 305, 185, "Multiple select options") browser->box(FL_GLEAM_UP_BOX) browser->color(19); browser->selection_color(FL_BLACK) browser->labelcolor(FL_BLACK); browser->textcolor(FL_BLACK); browser->callback(checkbox_demo) browser->align(FL_ALIGN_TOP_LEFT) browser->add("build-essential") browser->add("libgtksourceview2.0-dev") browser->add("libgtk2.0-dev") browser->add("libgtksourceview-3.0-dev") browser->add("libgtk-3-dev") browser->add("librsvg2-dev") browser->add("libcairo2-dev") browser->add("geany") My_ok = new Fl_Button(10, 230, 140, 30, "Install Packages") My_ok->box(FL_GLEAM_UP_BOX) My_ok->callback(checkbox_demo) My_Edit = new Fl_Multi_Browser(335, 40, 220, 185, "You have chosen") My_Edit->box(FL_GLEAM_UP_BOX) My_Edit->color(19) My_Edit->selection_color(FL_BLACK) My_Edit->labelcolor(FL_BLACK) My_Edit->textcolor(FL_BLACK) My_Edit->align(FL_ALIGN_TOP_LEFT) OS_USED = new Fl_Output(400, 235, 75, 25, "OS type") '--- get operating system MY_OS$ = CHOP$(EXEC$("dpkg --print-architecture")) OS_USED->value(MY_OS$) WIN->show() Fl::run()
|
|
|
Post by rikky on Jun 30, 2018 7:22:17 GMT 1
Rik.
|
|
|
Post by bigbass on Jun 30, 2018 7:40:21 GMT 1
Hello Rik
updated the install part it had a $TERM command I removed it and did it a better way you can comment out this line while testing to see if that helps
EXEC$("xterm -bg BLACK -fg WHITE -e sudo apt-get install \"$result_selected\"")
thanks for the feedback
just booted clean with the compiled app and it installed the debs correctly
Joe
|
|
|
Post by Pjot on Jun 30, 2018 7:57:31 GMT 1
Hi Rik,
The code from bigbass is compiled by g++, so the C++ compiler. That means you have to link with '-lbacon++'.
Alternatively, you can add the '-a' flag so a local static lib is created by g++.
HTT Peter
|
|
|
Post by rikky on Jun 30, 2018 13:04:56 GMT 1
Yep, both methods work bacon -a, or bacon -lbacon++ Rik.
|
|
|
Post by bigbass on Jun 30, 2018 17:50:43 GMT 1
Hey vovchik
After following Peter's advice about the need for installing
sudo apt-get install osspd all worked correctly
Just as a feedback report mint 19 uses
PRAGMA INCLUDE <linux/soundcard.h>
Your touch pad with dial sound effects works perfectly! great job with the GUI and the sound backend
*A side note since I am using a beta mate 19 it wouldn't be of any use to post error reports until mint 19 goes stable but if it works I'll let you know
att: Peter P.S. I'll add that in the main code PRAGMA LDFLAGS -lbacon++ Thanks again
Joe
|
|
|
Post by vovchik on Jun 30, 2018 22:29:14 GMT 1
Dear Joe,
Thanks - I am glad the gui now works and btonegen makes sound. I like the apt-get gui, too. I will do a hug version so that both versions can be compared for easy reference. People will be able to see what real fltk syntax is like in your version and how hug-fltk wrapping functions work (and how both can be mixed). It hope it will be instructive.
With kind regards, vovchik
|
|
|
Post by vovchik on Jul 7, 2018 11:43:06 GMT 1
Dear all, I incorporated Erco's dumb terminal widget into hug-fltk. Here it is. Let me know whether it works for you. With kind regards, vovchik Attachments:
termfltk-src.tar.gz (25.91 KB)
|
|