You are not logged in.

#1 2011-10-19 21:28:06

Lazze
Member
From: Bangkok, Thailand
Registered: 2008-09-28
Posts: 133

Gtk Viewport adds a 2px border

Hello

I'm currently trying to put together a simple text editor using Vala, just for learning.
In this text editor I have a Label which contains the line numbers and a TextView which is the editor itself, these two are inside Box.

Since I want to allow scrolling I've put the box inside a Viewport since the Box isn't a scrollable widget and then I've put the Viewport inside a ScrolledWindow.

My Code looks like this:

var hbox = new Box(Orientation.HORIZONTAL, 0);
var viewport = new Viewport(null, null);
var scroll = new ScrolledWindow(null, null);

hbox.pack_start(line_numbers, false, true, 0);
hbox.pack_start(this, true, true, 0);

viewport.add(hbox);

scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
scroll.add(viewport);


The problem is that a get a 2px space around the Box when using the Viewport, if I remove the Viewport the space disappears but then scrolling won't work.
Anyone have any idea why the viewport adds this space and how to get rid of it?

Thanks

Last edited by Lazze (2011-10-19 21:33:48)

Offline

Board footer

Powered by FluxBB