TIP #147: MAKE GRID'S COLUMN/ROW CONFIGURE EASIER =================================================== Version: $Revision: 1.5 $ Author: Peter Spjuth State: Final Type: Project Tcl-Version: 8.5 Vote: Done Created: Tuesday, 05 August 2003 URL: https://tip.tcl-lang.org147.html Post-History: ------------------------------------------------------------------------- ABSTRACT ========== This TIP proposes to add an alternative way to state which columns/rows in a grid are affected by an column/rowconfigure command. RATIONALE =========== Usually when doing a grid layout I tend to think in terms of what I want to do with a particular widget. For example a canvas or a frame that I want to expand within a resized window. Currently I need to translate that intention into a column and a row number to pass to column/rowconfigure. A more direct approach would be to pass the widget name directly to column/rowconfigure. Another situation is when all columns should be affected. Here I currently need to list them all {0 1 2 3 4 5}. Allowing an "all" keyword makes it easier and the code becomes more maintainable since you can add/remove columns without updating the list. What should be done when columnspan is greater than 1? There are three obvious possibilities: affect all, affect the first and affect the last. Any of these may be wanted by a programmer at one time or another so whatever is chosen, someone will be annoyed with it. Affecting all seems most logical. See also SPECIFICATION =============== Anywhere /column/ is used below, the same applies to /row/ too. In the /index/ argument to /grid columnconfigure/, widget names and the keyword "all" is recognised besides the normal integers. When a widget name is used, it must be currently managed by the given /master/. The columns currently occupied by the widget are affected by the command. When the keyword "all" is used, all columns currently occupied by widgets in /master/ are affected by the command. /Note:/ "Currently occupied" means at the time of the invocation of the /grid columnconfigure/ command. The grid does not try to trace if a widget is moved in the grid or if more widgets are added. EXAMPLES ========== canvas .c scrollbar .sbx -orient horizontal scrollbar .sby -orient vertical grid .c .sby -sticky news grid .sbx -sticky we grid columnconfigure . .c -weight 1 grid rowconfigure . .c -weight 1 button .b1 -text a button .b2 -text b button .b3 -text example button .b4 -text xyzzy grid .b1 .b2 .b3 .b4 -sticky news grid columnconfigure . all -uniform a -weight 1 OTHER POSSIBILITIES ===================== One possibility that is not proposed in this TIP is to also recognise the end-style indexing that indices in Tcl support (through /TclGetIntForIndex()/.) Comment: "Personally, I think that end-index handling will be quite tricky since it would require knowing what the *user* thinks is the last column." REFERENCE IMPLEMENTATION ========================== Not implemented yet. COPYRIGHT =========== This document has been placed in the public domain. ------------------------------------------------------------------------- TIP AutoGenerator - written by Donal K. Fellows