comp.lang.ada
 help / color / mirror / Atom feed
* GtkAda Tree_View properties
@ 2007-05-22 11:36 Dr. Adrian Wrigley
  2007-05-22 13:21 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. Adrian Wrigley @ 2007-05-22 11:36 UTC (permalink / raw)


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;




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GtkAda Tree_View properties
  2007-05-22 11:36 GtkAda Tree_View properties Dr. Adrian Wrigley
@ 2007-05-22 13:21 ` Dmitry A. Kazakov
  2007-05-25  0:05   ` Dr. Adrian Wrigley
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-22 13:21 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GtkAda Tree_View properties
  2007-05-22 13:21 ` Dmitry A. Kazakov
@ 2007-05-25  0:05   ` Dr. Adrian Wrigley
  2007-05-25  8:01     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. Adrian Wrigley @ 2007-05-25  0:05 UTC (permalink / raw)


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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GtkAda Tree_View properties
  2007-05-25  0:05   ` Dr. Adrian Wrigley
@ 2007-05-25  8:01     ` Dmitry A. Kazakov
  2007-05-25 14:43       ` petter_fryklund
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry A. Kazakov @ 2007-05-25  8:01 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GtkAda Tree_View properties
  2007-05-25  8:01     ` Dmitry A. Kazakov
@ 2007-05-25 14:43       ` petter_fryklund
  2007-05-25 15:12         ` Dr. Adrian Wrigley
  0 siblings, 1 reply; 6+ messages in thread
From: petter_fryklund @ 2007-05-25 14:43 UTC (permalink / raw)


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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GtkAda Tree_View properties
  2007-05-25 14:43       ` petter_fryklund
@ 2007-05-25 15:12         ` Dr. Adrian Wrigley
  0 siblings, 0 replies; 6+ messages in thread
From: Dr. Adrian Wrigley @ 2007-05-25 15:12 UTC (permalink / raw)


On Fri, 25 May 2007 07:43:11 -0700, petter_fryklund wrote:

> 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.

Good principle!

I follow this by using Annex E partitions.  Each partition handles
one of data analysis, data collection or user interface. The partitions
can run on different machines, be started and stopped separately,
and even recompiled without stopping the program.  Simple. Cool!
Of course it's all in Ada, and it might be simpler to build the MMI
with another language as you do.
--
Adrian




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-05-25 15:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-22 11:36 GtkAda Tree_View properties Dr. Adrian Wrigley
2007-05-22 13:21 ` Dmitry A. Kazakov
2007-05-25  0:05   ` Dr. Adrian Wrigley
2007-05-25  8:01     ` Dmitry A. Kazakov
2007-05-25 14:43       ` petter_fryklund
2007-05-25 15:12         ` Dr. Adrian Wrigley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox