Gridbox(3) Version 1.0 Gridbox(3) Aug 1998 NAME Gridbox DESCRIPTION The Gridbox widget manages one or more child widgets, arranging them in a grid of cells, aligned vertically and horizontally. Rows and columns may be different sizes, depending on the needs of the widgets they contain. Child widgets may span any number of rows and/or columns of the grid, allowing highly flexible layout policies. Child widgets may have weights specified, which control how the child widgets are resized when the parent Gridbox is resized. CLASS Compound => Constraint => Gridbox Gridbox does not require any specific widget set, and may be combined with any other widget set. RESOURCES center box; cBsss lB|lB|lB|lB l|l|l|l. Gridbox Name Class Type Default defaultDistance Thickness Dimension 4 See the Core, Composite, and Constraint widgets for more resources. Descriptions. defaultDistance Specifies the margins around child widgets. CONSTRAINT RESOURCES Constraint resources are set for the individual child widgets. center box; cBsss lB|lB|lB|lB l|l|l|l. Gridbox Constraints Name Class Type Default gridx Position Position 0 gridy Position Position 0 gridWidth Width Dimension 1 gridHeight Height Dimension 1 fill Fill FillType both gravity Gravity int Center weightx Weight int 0 weighty Weight int 0 margin Margin int defaultDistance Descriptions. gridx, gridy The widget's position in the grid. Upper-left corner is 0,0 gridWidth, gridHeight Widget size in cells. - 1 - Formatted: November 14, 2024 Gridbox(3) Version 1.0 Gridbox(3) Aug 1998 fill Determines how the widget is resized to fill its cell. Value may be any of none, width, height, and both. gravity Determines how the widget is positioned within its cell. Acceptable values are NorthWest, North, NorthEast, West, Center, East, SouthWest, South, and SouthEast. This resource has no effect if the widget's fill resource is "both". weightx, weighty Determines how the widget's cell is resized in response to Gridbox resize. When the gridbox is resized, any extra space is distributed to the rows and columns based on weight. Each row and column in the grid has a weight which is the maximum weight of all the widgets in that row or column. Whenever the Gridbox is larger than the size required to contain all of the child widgets, the excess space is distributed to each row or column in proportion to that row or column's weight. If all weights are zero, the rows and columns are not resized. PROGRAMMING TIPS Every child of a Gridbox widget must be assigned gridx and gridy constraints, or they will all overlap each other in the upper-left corner of the Gridbox. Note: unless, of course, this is what you want. If all Gridbox children are assigned the same cell, they will also be assigned the same dimensions. You could then control their visibility by altering their stacking order. A menu bar may be created in Athena through the use of a grid box: 1 Create a gridbox 2 Create a menuButton for each menu. Set the borderWidth and shadowWidth of all menuButtons to zero. Set gridx to the button's position in the menu bar. Set gridy to zero. 3 The "Help" menuButton is given a weightx constraint of 1 so that its cell will fill the rest of the menu bar. The fill constraint is set to none so that the button is not resized. The gravity constraint is set to east so that the button is at the east end of the menu bar. Alternatively, a blank label widget (or perhaps one containing a logo) is placed between the left buttons and the Help button, and allowed to fill the available space. - 2 - Formatted: November 14, 2024 Gridbox(3) Version 1.0 Gridbox(3) Aug 1998 AUTHOR Edward Falk <falk@falconer.vip.best.com> COPYRIGHT Copyright 1999 by Edward A. Falk. This widget may be used freely in any software. Source code is freely distributable provided that my name is not removed from it. The X Consortium, and any party obtaining a copy of these files from the X Consortium, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty- free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons who receive copies from any such party to do so. - 3 - Formatted: November 14, 2024