Re: GUIKit - ScrollPane Tables within Wizard
- To: mathgroup at smc.vnet.net
- Subject: [mg53044] Re: [mg52852] GUIKit - ScrollPane Tables within Wizard
- From: Jeff Adams <jeffa at wolfram.com>
- Date: Tue, 21 Dec 2004 05:19:23 -0500 (EST)
- References: <200412150926.EAA10576@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Dec 15, 2004, at 3:26 AM, paulw at cwgsy.net wrote: > Hi, > > I am having a few problems getting Widget["Table"] to work how i want > within a Widget["ScrollPane"] when constructing a wizard. The Table > needs columns for; Name, Colour, Move up, Move down. Basically a list > of objects with associated colours and the ability to move up/down in > the order. > > The first thing I have tried to do is resize the table columns > automatically to fit the column headers(or largest entry in the column) > so that the tables are more appropriately distributed. > > However, there does not appear to be a command to adjust column width, > only to change the defaut AutoResize from 2(fill screen evenly) to 0 > (leave at default size and use horizontal scroll bar). ... Hello, To answer the first question in this email separately... One way to adjust column widths in a table is to set the "PreferredWidth" and/or "MinWidth", "MaxWidth" and "Resizable" properties on the columns of the table. The column widgets of a table are available through the "ColumnModel" of the table. To illustrate this with an example notice the default behavior of the table column width choices that evenly distributes spacing: GUIRun[ Widget["Panel", { Widget["ScrollPane", { "PreferredSize" -> Widget["Dimension", {"Width" -> 300, "Height" -> 110}], "ViewportView" -> Widget["Table", { "Items" -> {{"A", True, "A longer column value"}, {"B", False, "Another longer column value"}}, PropertyValue["Model", Name -> "myTableModel"], SetPropertyValue[{"myTableModel", "ColumnIdentifiers"}, {"Index", "Active", "Description"}] }, Name -> "myTable"] }] }] ] We would really like to have the Description column use most of the spacing and the boolean checkbox column does not need to be resizable from the user standpoint since it doesn't take up much space. Below I show through an extra setup Script how you can get access to the column widgets of the table and then use various combinations of the "PreferredWidth", "MinWidth", "MaxWidth" and "Resizable" properties to control not only whether a column is resizable but ranges of valid widths that the user can use: GUIRun[ Widget["Panel", { Widget["ScrollPane", { "PreferredSize" -> Widget["Dimension", {"Width" -> 300, "Height" -> 110}], "ViewportView" -> Widget["Table", { "Items" -> {{"A", True, "A longer column value"}, {"B", False, "Another longer column value"}}, PropertyValue["Model", Name -> "myTableModel"], SetPropertyValue[{"myTableModel", "ColumnIdentifiers"}, {"Index", "Active", "Description"}], PropertyValue["ColumnModel", Name -> "columnModel"], Script[ col = PropertyValue[{"columnModel", "Column", 1}]; SetPropertyValue[{col, "PreferredWidth"}, 50]; SetPropertyValue[{col, "MaxWidth"}, 50]; SetPropertyValue[{col, "Resizable"}, True]; col = PropertyValue[{"columnModel", "Column", 2}]; SetPropertyValue[{col, "PreferredWidth"}, 50]; SetPropertyValue[{col, "MaxWidth"}, 50]; SetPropertyValue[{col, "MinWidth"}, 50]; ] }, Name -> "myTable"] }] }] ] Jeff Adams Wolfram Research
- References:
- GUIKit - ScrollPane Tables within Wizard
- From: paulw@cwgsy.net
- GUIKit - ScrollPane Tables within Wizard