Text Size Constraints 
Author Message
 Text Size Constraints

Here's the scenario: I have a table, with headings and predefined entries,
set up like this:

-------------------------------------------------------------------------
| Period                               |     From     |       To        |
-------------------------------------------------------------------------
|   1                                  |  Day HH:MM   |    Day HH:MM    |
|   2                                  |  Day HH:MM   |    Day HH:MM    |
|   3                                  |  Day HH:MM   |    Day HH:MM    |
-------------------------------------------------------------------------

The frames for the table above are:

-------------------------------------------------------------------------
| headings are packed into this frame                                   |
-------------------------------------------------------------------------
| Period 1 values are packed into this frame                            |
-------------------------------------------------------------------------
| Period 2 values are packed into this frame                            |
-------------------------------------------------------------------------
| Period 3 values are packed into this frame                            |
-------------------------------------------------------------------------

Now, the headings are in their own frame, and each line of the table is
in its own frame. Users supply scripts which may optionally define
fields to be inserted into the table, between the "Period" column
and the required time columns.

-------------------------------------------------------------------------
| Period   Name   Long Heading         |     From     |       To        |
-------------------------------------------------------------------------
|   1    ======== ========             |  Day HH:MM   |    Day HH:MM    |
|   2    ======== ========             |  Day HH:MM   |    Day HH:MM    |
|   3    ======== ========             |  Day HH:MM   |    Day HH:MM    |
-------------------------------------------------------------------------

The problem I am having is in lining up new headings with data columns.
The headings are in their own frame, and the data are entries in other
frames. I can set the width of the data values (in Entry items), and if
I use the same font in the data entries and headings, I can set the -width
the same and things line up. But, if the heading is too long, and I want
to use a narrower font, then the -width value for the heading and data
don't necessarily correlate.

I tried enclosing each data Entry and heading Label in Frames, and
using the frame width from the data entry to set the -width of the
heading's frame, but the enclosed text causes it to grow to display the
text. How can I contrain a text field (Entry or Label) to reside in a
fixed-width Frame? Frames have -width in pixels or inches, etc., and
text values have -width in terms of character widths. I even tried using
the avgWidth values from the font specification, but that didn't seem
to help. (Of course, I don't know what they really do, either. I was
hoping that using two different fonts, but specifying equal avgWidth values
would cause the -width values to line them up properly.)

Is this at all clear? If you have any ideas, I'd welcome them. As of
now, I'm sort of brute-forcing things into reasonably aligned columns, but
it'd be nice to be able to scale the heading font as required to fit it
into the data column's width as closely as possible.

Thanks,
Steve

BTW, this is my first PerlTk application, and in reading the PerlRef pages,
I saw that "Closure is not something most Perl programmers need trouble
themselves about to begin with."

Well, it was just exactly what I wanted, in hooking up buttons to
routines at compile time, but having them use values defined at run time.
Thanks, Larry!



Sun, 22 Nov 1998 03:00:00 GMT  
 Text Size Constraints

Quote:

> Here's the scenario: I have a table, with headings and predefined entries,
> set up like this:

> -------------------------------------------------------------------------
> | Period                               |     From     |       To        |
> -------------------------------------------------------------------------
> |   1                                  |  Day HH:MM   |    Day HH:MM    |
> |   2                                  |  Day HH:MM   |    Day HH:MM    |
> |   3                                  |  Day HH:MM   |    Day HH:MM    |
> -------------------------------------------------------------------------

...
> The headings are in their own frame, and the data are entries in other
> frames. I can set the width of the data values (in Entry items), and if
> I use the same font in the data entries and headings, I can set the -width
> the same and things line up. But, if the heading is too long, and I want
> to use a narrower font, then the -width value for the heading and data
> don't necessarily correlate.

Thats life :-(

Quote:

> I tried enclosing each data Entry and heading Label in Frames, and
> using the frame width from the data entry to set the -width of the
> heading's frame, but the enclosed text causes it to grow to display the
> text. How can I contrain a text field (Entry or Label) to reside in a
> fixed-width Frame? Frames have -width in pixels or inches, etc., and
> text values have -width in terms of character widths. I even tried using
> the avgWidth values from the font specification, but that didn't seem
> to help. (Of course, I don't know what they really do, either. I was
> hoping that using two different fonts, but specifying equal avgWidth values
> would cause the -width values to line them up properly.)

This is what Table is for. Table arranges for all items in a column to be same width,
and all items in a row to be same height.
It has other bells and whistles too (even if a little cracked ;-)).
In particular you can scroll a list of rows leaving headings inplace.

Note in this case it means that a wide label will mean a wide entry too, so you
_could_ just use label's font for entry...

- Show quoted text -

Quote:

> Is this at all clear? If you have any ideas, I'd welcome them. As of
> now, I'm sort of brute-forcing things into reasonably aligned columns, but
> it'd be nice to be able to scale the heading font as required to fit it
> into the data column's width as closely as possible.

> Thanks,
> Steve

> BTW, this is my first PerlTk application, and in reading the PerlRef pages,
> I saw that "Closure is not something most Perl programmers need trouble
> themselves about to begin with."

> Well, it was just exactly what I wanted, in hooking up buttons to
> routines at compile time, but having them use values defined at run time.
> Thanks, Larry!



Fri, 27 Nov 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to constraint windows size

2. CGI.pm Bug: file upload file size mismatch when file size is close to buffer size

3. Looking for a way to make the size of text smaller

4. size of text

5. Extracting font size ONLY from text widget with -cget

6. Extracting the Text widget current size

7. size of text

8. Getting size of Tk Text widget

9. Text sizes

10. Canvas text item font size.

11. DBD::Sybase Howto print only parts of constraint error messages

12. DBD::Pg: how to retrieve table constraints?

 

 
Powered by phpBB® Forum Software