Re: scales of different lengths?



Juhana Sadeharju wrote:

Hello.
My GUI is following
 vbox {
   800x600 drawing area
   hscale
   hscale
 }

The problem is that both hscales extents 800 pixels,
while I would like to have them 400 and 200 pixels
respectively. How to do it?

At first, if not absolutely required, i.e. by fixed size bitmaps, please
forget about widths in pixels. Dynamics and flexibility are a
fundamental concept of GTK-based GUI design. This is foiled if designing
the GUI with pixel measures in mind. This is not what users expect (or
probably like) from GTK programs. So I won't help you constraining your
widgets to pixel values.

However, not having the widgets filling the entire width of a window is
a reasonable desire. For your case I assume you want to have two
hscales, 50% and 25% of the width of the window. That's fine.

The (a?) way to achieve this is to use tables with the homogeneous flag
set, some spare fields and the col span (or row span) properties. For
the following step by step instructions I assume you want each hscale
being placed centered at its respective row. Having it left- or
right-aligned makes it just a bit easier (and probably uglier) because
you need just half of the columns given below.

1.1. create a table of 1 row by 4 columns.
1.2. make it homogeneous.
1.3. put a hscale into column 2.
1.4. make it spanning 2 columns.

You have a hscale with 50% width of the parent container (the window).
It's structure is:
+--------+-------+---------+--------+
| empty  |hscale, 2 columns| empty  |
+--------+-------+---------+--------+

2.1. create a table of 1 row by 8 columns.
2.2. make it homogeneous.
2.3. put a hscale into column 3.
2.4. make it spanning 2 columns.

You have a hscale with 25% width of the parent container (the window).
If the width should be 33% of its window then a table with only three
columns (and no col span for the hscale) would be required.

This way the GUI retains its dynamics (which includes themeability as
well) while fulfilling your structural demands. Watch how it behaves
when you resize its parent window.

BTW, can GTK 1.2 and GTK2 co-exist in the Linux? I almost
deleted all the GTK1.2 stuff out, but in the last second
I thought there might be programs using the GTK 1.2 shared
libraries :-O

They can coexist since they use different names for binary and header
files. You should keep GTK 1.2 since there is quite a number of older
but common applications around which are committed to GTK 1.2.



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