TIP #146 Version 1.10: Add Overall Anchoring to the Grid Geometry Manager

This is not necessarily the current version of this TIP.


TIP:146
Title:Add Overall Anchoring to the Grid Geometry Manager
Version:$Revision: 1.10 $
Author:Peter Spjuth <peter dot spjuth at space dot se>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Tuesday, 05 August 2003

Abstract

This TIP proposes to add an anchor option to grid managers to control the behaviour of a grid where all weights are zero.

Rationale

Have you ever found yourself adding "-weight" to an unused row or column in a grid? That is usually the workaround to use when you have no "-weight" on any column but you don't want things to sit in the middle of the grid when the window is grown.

By adding an anchor option it lets the code directly reflect the intention of the programmer and it makes the code more maintainable since you can add and remove columns without having to update the dummy weight.

Shrinking a Grid

When growing a grid, the behaviour is rather simple. Follow the weights and when 0, follow the anchor.

When shrinking a grid without weight things get more interesting.

The previous behaviour of the grid is a bit inconsistent in that when grown it centers the slaves (as in anchor "center") and when shrunk it shows the upper left part (as in anchor "nw").

Thus, following the new anchor will not be backwardly compatible, even though I doubt it can be common for people to rely on that behaviour.

For shrinking a grid without weight there are three options.

  1. Always clip the bottom/right. i.e. behave as now.

  2. Clip according to anchor.

  3. Try to shrink all columns/rows, and only clip when minsize stops further shrinking. (Clip according to anchor)

I think 2. makes more sense than 1., but it does mean a minor compatiblity breach. Also, with 2., behaviour 1. and 3. can be emulated but the other way around is harder.

With 2, there are also two choises how to break compatibility depending on the default anchor.

2a: With default anchor ''center''

Anyone relying on the bottom/left clipping will find things clip all around. Potentially an important widget in the nw corner can end up outside.

2b: