Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 19:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to use TreeView Widget in GTK-Server?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Sat 24 Mar 2012, 16:40    Post subject:  How to use TreeView Widget in GTK-Server?  

BaCon has a limited number of widgets and they have few properties.
But it is compiled so will work on most Linuxes, and GTK-Server will too.
GTK-Server will do almost all widgets and their properties.

The Tree View Widget and List Store are about the most complex in GTK+.
It`s not quick easy to use like the old List Box, it does a lot more now.
The Tree View widget is a TreeView, a ListBox, and a TableBox ( Grid ).
And it will render in it`s cells; ProgressBars, CheckBoxes, ComboBoxes, etc.

I can get a white box to show but no detail in it shows.

It would be nice to wrap all of this in a shell of easy to use of syntax.
GTK+ has rather messy syntax and lots could be done to improve it.
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2225
Location: The Blue Marble

PostPosted: Thu 12 Apr 2012, 23:38    Post subject:  

104 reads and no replies? Poor sunburnt ...

I hope the attached code will help. It's a skeleton of what would be the new Fatdog64 Installer, but for you the most important thing is that it has a working TreeView widget with TreeStore - filling in the view, and getting values back when cursor is moved.

No tidy wrapper here - just raw GTK+ API.
Note: the attached GtkBuilder file is designed for GTK 2.16 or newer.
installer.tar.gz
Description  script and GtkBuilder xml file
gz

 Download 
Filename  installer.tar.gz 
Filesize  3.74 KB 
Downloaded  190 Time(s) 

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Fri 13 Apr 2012, 03:54    Post subject:  

Thanks jamesbond ! I`m surprised that anyone answered really.

GTK+ has rotten syntax and a messy way it defines and sets up controls.
It`s far more complex and codey than it needs to be to get the job done.
On top of that it`s changing drastically all the time so anyone using it directly
( GtkDialog for one ) is enslaved to it. They have my complete sympathy.

I`ll examine your code offering this weekend, again... Many thanks! Terry
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 13 Apr 2012, 04:19    Post subject:  

Dear guys,

I will also have a look. Terry is right that so much code is needed just to do rather simple things - which means there is a need for intelligent wrappers.....

With kind regards,vovchik

PS. For HUG we could do a few of them (widgets) - but treeview is a real pain although very useful, and if the implementations are proper, Peter will incorporate, in general. But they have to be totally integrated into HUG, which means getting your hands a bit dirty doing a very clean implementation for HUG bookkeeping. Of course I would like to have all the widgets available, but handcoding teaches you some things, and we are not about to change GTK, so we have to read a bit and work a bit....Smile
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Fri 13 Apr 2012, 12:08    Post subject:  

vovchik; I have access to a book about GTK+ with some C code. It`s probably GTK+2.xx so the problem of changes as always is there.
The examples are made overly complex like so many books I`ve seen. Instead of teaching, they`re written to obscure simple understanding.

I`ll get it and post some examples here to try and figure it out.
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2225
Location: The Blue Marble

PostPosted: Fri 13 Apr 2012, 21:28    Post subject:  

I beg to differ. All GUI code is convoluted. I'm sure you have glimpsed into Java Swing framework, Qt, or wxWidgets - I personally don't think they are any simpler. GTK+ in my opinion is one of the more sensible one. The key to doing GUI is that one shouldn't be building the GUI by hand. One should use a GUI designer.

GTK+ has the API to build GUI elements in code, but that should only be used when there is a reason to do so (ie, making a super-dynamic on-the-fly always-changing GUI apps, e.g. GUI designer).

That's why I was overjoyed when I found gtk-server. Gtkdialog is nice, but you have to design your GUI by handcoding vbox hbox and the like by hand. I always consider that XML isn't for human consumption. Sure, with gtk-server it's more verbose, but that's just because GTK+ API has long function names. As a bonus you get more fine-grained control too.

If I only need simple GUI I'll go with Xdialog (or its friends, like yad, zenity, etc).

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Sat 14 Apr 2012, 16:29    Post subject:  

I agree, most simple guis I`ve made I`ve done with Xdialog.
GtkDialog is great for what Barry wanted it for, Puppy`s utility dialogs.

As vovchik said, sensible wrappers for Gtk-Server and HUG.
In both you will always have the gritty GTK+ fine-tune interface.

HUG is a wrapper, so it`s syntax is set, but Gtk-Server is more open.
I think a higher level syntax ( Visual Basic like...) would be very good.
It is easier to look at and understand, and more flexible in usage.

Examples:
Code:
Window.New Name = Win, X = 100, Y = 100 ,W = 300, H = 200
Title = New Window
Font = New Times
Button.New
Text = Exit

This shows the use of "current controls" assignment, the window and/or control is assumed.
Only the "New" and "Set" key words change the "current" window and/or control.
So another window and/or control can be accessed without changing which one`s current.
As in V.B., a simple command "(Control).New" makes a control with default property values.

I very much like the "dot" syntax and think it`s an excellent basis for a programming syntax.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0597s ][ Queries: 12 (0.0067s) ][ GZIP on ]