Re: aligning label strings



Am So, den 17.04.2005 schrieb Markus Lausser um 14:44:
On Mon, 2005-04-11 at 21:29, Marc Santhoff wrote:
Hi,

I'm trying to put the strings of several equally sized buttons in a one
row table in a special way:

------------------------------------------
|  F1 - first string                     |
------------------------------------------
|  F2 - something completely different   |
------------------------------------------ 
|  F3 - ...                              |
------------------------------------------

The problem for me is to deal with strings having arbitrary lengths not
know until creation of this buttons.

What GUI structure and alignment settings would make ensure these Labels
are appearing left aligned in a row (maybe being centered by the longest
string)?

If i understand right: you want vertically packed buttons with labels
that align to the left?

First part of the task, yes.

Second is to have the block of left aligned labels centered around the
middle of the longest string.

Pack the buttons into a vbox or a table column and use
  gtk_button_set_alignment(button, 0.0, 0.5);

The buttons are in a table from the start. The problem was to have
different spacing because of the string length change. Imagine some very
short strings, then the label are all shifted to the left side. This is
looking "irregular" on a screen filling dialog.

But since I'm using GTK+ 1.2 and cannot switch to 2.x this was somewhat
difficult to solve. For now I'm using a predefined spacer label with
enough spaces in it for each set of strings.

A better solution would be welcome although...

Thank you,
Marc





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