Re: Aligning ToolItem To Right in Toolbar



On 08/27/2013 02:18 AM, Colomban Wendling wrote:
Le 27/08/2013 08:07, Joshua Strobl a écrit :
[...] and set to expand horizontally (set_hexpand(true)).
Tip: you could use the Vala-style property setter, toolbar.hexpand=true

I think at the time I was getting compile-time errors so I thought it was
an issue with my syntax. I much prefer to "Vala-style" property setting as
compared to using a set_* function for everything. Much cleaner. Thanks
for the suggestion, I'll certainly make use of it!

AFAIK the correct solution is using a separator item set to be invisible
and to expand.  I didn't do Vala for at least a year so excuse the maybe
crappy style, but:

      var sep = new Gtk.SeparatorToolItem();
      sep.draw = false;
      toolbar.add(sep);
      toolbar.child_set(sep, expand:true);

This way you have the items after the separator pushed to the right[1]
-- and as a bonus you see a nice separator in the overflowing items menu
if the toolbar has to show it.

https://developer.gnome.org/gtk3/stable/GtkSeparatorToolItem.html#GtkSeparatorToolItem.description
https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar--c-expand


Thanks for linking me to it. At the time I was using the offline docs I
downloaded (and dealing with slow McDonalds wifi when I was away from
the house) and it isn't so parsable / digestible that way.

Regards,
Colomban

Thank you Colomban and Florian for your assistance =) It was appreciated.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]