Label with fixed size

2014-08-28 Thread rastersoft

Hi all:

I need to create a label with a fixed size in pixels, and if the text is 
too large, elipsize it. Is it possible? I tried nearly all kind of ways 
and tricks (even capturing the size-allocate signal and adjust there the 
maximum-character property until the size is fine), but can't get it.


Thanks.

--
Nos leemos
 RASTER(Linux user #228804)
ras...@rastersoft.com  http://www.rastersoft.com

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problems Sending Input/Focus to Plug Window - Solution

2014-08-28 Thread Benjamin Schnitzler
Ok, it's already implemented, though using a huge framework like gtk can
sometimes make it a tough job to find the right trigger. The plug/socket example
could be a bit more detailed, but I guess the gtk Developers are quite busy,
like us ;). Anyways, here is the solution:

socket->child_focus(Gtk::DIR_TAB_FORWARD);

For your convenience, the link to Gtk::DirectionType:
https://developer.gnome.org/gtkmm/3.11/group__gtkmmEnums.html#ga6c754c32a8421f746367b43c277e4d7b

One little question remains: Is there any way to put the focus to an embedded
xterm? It somehow seems, that xterm does not follow the xembed protocoll
correctly.

Be wild and genius,
  
  Benjamin
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Label with fixed size

2014-08-28 Thread Stefan Salewski
On Thu, 2014-08-28 at 18:14 +0200, rastersoft wrote:
> Hi all:
> 
> I need to create a label with a fixed size in pixels, and if the text is 
> too large, elipsize it. Is it possible? I tried nearly all kind of ways 
> and tricks (even capturing the size-allocate signal and adjust there the 
> maximum-character property until the size is fine), but can't get it.
> 
> Thanks.
> 

When you REALLY need this, you may try the GTK Fixed container.
It allows to position widgets at absolute positions, and at the same
time, it prevents widgets from expanding itself.

Try the Ruby code below -- for me it always displays "Not a..." even
when I resize the main window. Of course you may read the documentation
of the Fixed container.

require 'gtk3'

window = Gtk::Window.new
window.border_width = 10
window.set_default_size(80, -1)

window.signal_connect("destroy") {Gtk.main_quit}

f = Gtk::Fixed.new
l = Gtk::Label.new('Not a long text')
l.set_size_request(50, -1)
l.ellipsize = Pango::ELLIPSIZE_END

#f.put(l, 0, 0)
f.add(l)

window.add(f)
window.show_all

Gtk.main


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list