D - about dig
- Lloyd Dupont (6/6) Nov 21 2002 I just beging to read dig code... (and soon use..)
- Burton Radons (72/77) Dec 01 2002 Sorry about the long delay. I'd been meaning to make an example with a
I just beging to read dig code... (and soon use..) well it's huge and I think a bit of help might be needed. could one explain me the grid fitting / resizing behavior of control... it's unclear to me. thanks, Lloyd
Nov 21 2002
Lloyd Dupont wrote:I just beging to read dig code... (and soon use..) well it's huge and I think a bit of help might be needed. could one explain me the grid fitting / resizing behavior of control... it's unclear to me.Sorry about the long delay. I'd been meaning to make an example with a screenshot to show it, but then forgot about the message, and now I can't make the example very clear. What you're doing with grid fitting is defining controls to be part of a table. column (the first argument to grid) is the horizontal cell, row the vertical. If a control needs to span across a number of other controls, then you supply third and fourth arguments to grid that indicate how large the control is in cells. For example, if a and b are side-by-side and c should be below them but cover their range, then you'd do: a.grid (0, 0); b.grid (1, 0); c.grid (0, 1, 2, 1); Which will create something like: +---+---+ | A | B | +---+---+ | C | +-------+ There's also the gridAddRow methods, which increment the row by the rowspan, and is handy for setting up large tables. The sticky method determines the placement of the control within its grid space, if the grid space is larger than the control itself. For example, c above might have a sticky of "|", meaning horizontal center. It would then be: +---+---+ | A | B | +-+-+-+-+ | C | +---+ The way I have it in the first diagram, it has a stickiness of "<>", which means to stretch it to fill its full horizontal potential. "<" is: +---+---+ | A | B | +---+---+ | C | +---+ ">" is: +---+---+ | A | B | +---+---+ | C | +---+ For vertical placement, there is "^" for top, "-" for vertical center, "v" for bottom, and "^v" for vertical stretch. So to make a control take its complete possible space, you would use "<>^v", although "^>v<" would also work. Past that, there's border and pad. border (x, y) is the number of pixels to indent children controls. It adds x and y on both the top/left and the bottom/right. pad (x, y) is the number of pixels to put around a control to separate it from other controls in this table. Grid-fitting by itself can become limiting when there's complex layouts, either in making them impossible or in making them needlessly complex. You can use the "Pane" control to define a sub-table. For example, the first diagram's controls could be setup with: Pane pane; with (pane = new Pane (control)) { grid (0, 0); with (new MyClass (pane)) caption ("A"), grid (0, 0); with (new MyClass (pane)) caption ("B"), grid (1, 0); } with (new MyClass ()) { caption ("C"); grid (0, 1); sticky ("<>"); } The advantage is that C has no knowledge about how A and B are setup, which allows you to move the controls around. Another important parent control is the GroupBox.
Dec 01 2002