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.
How to use TreeView Widget in GTK-Server?
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.
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.
- Attachments
-
- installer.tar.gz
- script and GtkBuilder xml file
- (3.74 KiB) Downloaded 296 times
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
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
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
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....
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....
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.
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.
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!
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 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
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:
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.
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: Select all
Window.New Name = Win, X = 100, Y = 100 ,W = 300, H = 200
Title = New Window
Font = New Times
Button.New
Text = Exit
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.