From: Dr. Adrian Wrigley on
Hi guys!

Sorry this is not strictly a language question, but I figure people
here will know the answer.

Using GtkAda, I was to set properties for a Gtk_Tree_View.

The lines in the widget have rather excessive vertical spacing.
I think if I set "ypad" and/or "vertical-separator" properties,
I could reduce the spacing. (this seems to be a perennial problem
with gtk programs now. I though I had solved it, but it became unsolved)

Can't I set the properties in a gtkrc file? (this had no effect)

Thanks for any input!
--
Adrian

-- Code fragment GtkAda, gtk2, Linux, GNAT etc.

procedure RunTrans (Frame : access Gtk.Frame.Gtk_Frame_Record'Class;
Model : out Gtk_Tree_Store) is

Tree : Gtk_Tree_View;

begin

Gtk_New (Model,
(Age_Column => GType_String,
-- stuff deleted
Strike_Column => GType_Boolean,
Editable_Column => GType_Boolean,
Active_Column => GType_Boolean,
Foreground_Column => GType_String));

Gtk_New (Tree, Model);

-- What goes here?
Set_Property (Tree, "ypad", 0); -- This does not compile

--...
end RunTrans;

From: Dmitry A. Kazakov on
On Tue, 22 May 2007 11:36:38 GMT, Dr. Adrian Wrigley wrote:

> Using GtkAda, I was to set properties for a Gtk_Tree_View.
>
> The lines in the widget have rather excessive vertical spacing.
> I think if I set "ypad" and/or "vertical-separator" properties,
> I could reduce the spacing. (this seems to be a perennial problem
> with gtk programs now. I though I had solved it, but it became unsolved)
>
> Can't I set the properties in a gtkrc file? (this had no effect)

Yes/No.

No, because in GTK there are properties and style properties which are
unrelated [bad design]. The style properties are controlled by RC files.
The object's properties are in free flight. Surely a given widget
implementation might derive some of its properties from style properties,
but this is up to the widget. When you browse the GTKAda documentation:

http://www.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm/gtk-tree_view.html

it lists properties and style properties separately. [click properties tab]

Note that likely the documentation does not list all style properties. If
you want to know all of them you should look into GTK+ sources.
Alternatively you can capture style properties of a widget using Put_Styles
from GtkAda contributions:

http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#4.5

Specifically for the tree view, my quick check shows the following style
property:

# Vertical space between cells. Must be an even number
# gint range 0 .. 2147483647 Default is 2
<class-name>::vertical-separator = 2

> Set_Property (Tree, "ypad", 0); -- This does not compile

This does not compile because the procedure Set_Property has the second
parameter of a non-string type. There is one "property name" type for each
type of the property values. I cannot tell for the merits of this design,
anyway, just use the function Build to convert string to "property name":

Set_Property (Tree, Build ("ypad"), 0); -- This will compile

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: Dr. Adrian Wrigley on
On Tue, 22 May 2007 15:21:49 +0200, Dmitry A. Kazakov wrote:
....
<helpful explanation removed>

Thank you Dmitry. I've just been upgrading everything here
to Debian etch, and lots of things have needed sorting out.

I found I had a ~/.gtkrc which already set the line spacing
to a minimum, but the gaps are still rather wide with small
fonts. I don't think there is an easy for for this. Other things seemed
to be problematic with the layout too (widgets becoming too small for
their contents).

One of the problems I had was with poor font sizes in
different applications - there seem to be about six different
configuration files for font size (.Xresources, xorg.conf,
..gtkrc, application settings, .fonts.conf etc). Now all these
are sorted out, I'll try adjusting the properties and
style properties in the code...

GTKAda contributions looks interesting - particularly the
TreeView stuff and Put_Styles. Somthing to play with when the
rest of the system is working properly!
--
Adrian

From: Dmitry A. Kazakov on
On Fri, 25 May 2007 00:05:08 GMT, Dr. Adrian Wrigley wrote:

> On Tue, 22 May 2007 15:21:49 +0200, Dmitry A. Kazakov wrote:

> I found I had a ~/.gtkrc which already set the line spacing
> to a minimum, but the gaps are still rather wide with small
> fonts. I don't think there is an easy for for this.

You can also look at the properties of the cell renderers you are using.
They have "ypad" (the default should be 0). There also is "height"
defaulted to -1, you could try to set it for the offending column.

> Other things seemed
> to be problematic with the layout too (widgets becoming too small for
> their contents).

Yes, this is a problem, GTK+ starts with the minimal possible size. There
is Set_Default_Size, but it is not exactly what needed. I don't know any
good solution for that. For columns of a tree view Set_Fixed_Width is
sometimes helpful.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: petter_fryklund on
I have adopted a principle from one of our customers: keep MMI and
Application separate. My hobby appliation is a bridge deal generator
written in Ada95. My MMI is written in Tcl/Tk. Communication is TCP/IP
using GNAT.Sockets. I have very good experience with this.