how to embed gtk in BaCon

For discussions about programming and projects not necessarily associated with Porteus.

how to embed gtk in BaCon

Postby bigbass » 09 Apr 2013, 16:41

I have been away for awhile
because I wanted to learn how to become a better programmer

and since gtk is the linux power tool default
starting there is the way to go or is it ?
but all the C code is just ugly
this is where you can combine gtk functions to build the GUI
and then do away with all the ugly pointers and use basic

using the PROTO command allows you to import gtk functions

http://basic-converter.proboards.com/index.cgi?action=gotopost&board=doc&thread=447&post=3770

I never liked gtk but it something I wanted to learn and use
it is a needed step for the linux toolbox

Joe
User avatar
bigbass
Contributor
Contributor
 
Posts: 151
Joined: 13 Jan 2012, 15:35
Distribution: slackware 14

Re: how to embed gtk in BaCon

Postby Ahau » 09 Apr 2013, 20:08

Welcome Joe, glad to have you back!

A few months ago, I was toying with the idea of learning C. I wanted to try creating a simple gui sound mixer for alsa that didn't rely on gnome, fltk, pulseaudio, or anything outside of the default Porteus iso. So I read some tutorials and made some CLI "hello world" programs, etc, and started to feel like I was getting the hang of it. Then, I opened the first gtk "hello world" tutorial and got so confused (and a bit intimidated), that I gave up and went on to something else. I'm glad to hear that BaCon is making it more accessible! Good luck, and I'm looking forward to seeing what you're able to put together with this!
Please take a look at our online documentation, here. Suggestions are welcome!
User avatar
Ahau
King of Docs
King of Docs
 
Posts: 1331
Joined: 28 Dec 2010, 16:18
Location: USA
Distribution: LXDE & Xfce 32/64-bit

Re: how to embed gtk in BaCon

Postby bigbass » 11 Apr 2013, 16:43

Hey Ahau!

There are several ways to solve a problem
the one that works for you at the time is the best :)
having different options allows us to get around big dependencies
and complex code

a simple hello world in pure BaCon is pretty easy there is a tutorial
Bacon has many simplified widgets already built in

but for larger projects were you want to use the full power of gtk
we have to embed some things (this is considered an advanced approach
after the basic widgets don't do everything you want)

but an embedded gtk hello world has to be converted to Bacon syntax
which takes a little bit of time but in the end what you are doing is IMPORTING
gtk functions so that they are available to be used inside Bacon
then instead of all the confusing memory address pointing that C code uses
we just use normal variables that don't need to be defined so strictly as C obligates you to do

I am converting all the official gtk examples to BaCon
so that getting started will be easier



updated to have a wiki page
you inspired me to start a mini how to http://code.google.com/p/bigbass-porteus/wiki/EmbedGtk3BaCon#TOP
Joe
User avatar
bigbass
Contributor
Contributor
 
Posts: 151
Joined: 13 Jan 2012, 15:35
Distribution: slackware 14

Re: how to embed gtk in BaCon

Postby bigbass » 12 Jun 2013, 18:15

bigbass-porteus

is officially dead due to googlecode not allowing updates after January
I will not be maintaining bigbass-porteus with any new updates


all my work will be moved and maintained at sourceforge
https://sourceforge.net/p/baconproto/wiki/Home/

all source code here for the examples
https://sourceforge.net/projects/baconproto/

I am working on embedding GTK/GDK and C code
making it easy to get some nice widgets in GTK3 and GTK2

and of course having fun in the process

P.S the new forum page looks great!


Joe
User avatar
bigbass
Contributor
Contributor
 
Posts: 151
Joined: 13 Jan 2012, 15:35
Distribution: slackware 14

Re: how to embed gtk in BaCon

Postby port » 17 Oct 2016, 09:21

bigbass wrote:but for larger projects were you want to use the full power of gtk
we have to embed some things (this is considered an advanced approach
after the basic widgets don't do everything you want)

but an embedded gtk hello world has to be converted to Bacon syntax
which takes a little bit of time but in the end what you are doing is IMPORTING
gtk functions so that they are available to be used inside Bacon
then instead of all the confusing memory address pointing that C code uses
we just use normal variables that don't need to be defined so strictly as C obligates you to do

I am converting all the official gtk examples to BaCon
so that getting started will be easier


if your only purpose is to use GTK from basic and BaCon maybe you would be interested in Gtk-Server which is a server listening to several channels for gtk commands, here you get an example written in Basic using gtk-server listening to FIFO channel.

In fact I've seen in BaCon web page an example to use gtk-server so you probably are aware of it and my whole message is useless ;-)
port
Samurai
Samurai
 
Posts: 114
Joined: 18 Feb 2016, 10:25
Location: Spain
Distribution: Linux porteus 3.2.2 KDE


Return to Programming



Who is online

Users browsing this forum: Bing [Bot] and 1 guest