Re: Re: GUIKit - ScrollPane Tables within Wizard
- To: mathgroup at smc.vnet.net
- Subject: [mg53089] Re: [mg53058] Re: GUIKit - ScrollPane Tables within Wizard
- From: Jeff Adams <jeffa at wolfram.com>
- Date: Thu, 23 Dec 2004 07:58:25 -0500 (EST)
- References: <200412150926.EAA10576@smc.vnet.net><cq8u0e$h3o$1@smc.vnet.net> <200412220952.EAA04436@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Dec 22, 2004, at 3:52 AM, paulw at cwgsy.net wrote: > Hi Jeff, thanks for the help i now have the column resize working > perfectly. > > With regards to the images, I have had no problem in creating images > for buttons etc and including them in the wizard. The problem comes > when I try to display the image inside a table. If i do this outside of > the wizard it displays fine. When i include the scrollpane/table within > the wizard it still displays JLink`Objects`JavaObject79699006980097 (as > an example). > > the script used to create the table is as follows: > > Needs["GUIKit`"]; > > x := Widget["WizardPage", > > {"title" -> "Overview", > "navigationNames" -> {"Back", "Next", "Cancel"}, > "content" -> Widget["ScrollPane", { > "preferredSize" -> Widget["Dimension", {"width" -> 200, > "height > " -> 260}], > "viewportView" -> Widget["Table", { > "columnEditable" -> {True, False}, > "SelectionMode" -> 0, > PropertyValue["model", Name -> "ColoursTableModel"], > Script[SetPropertyValue[{" > ColoursTableModel", "columnIdentifiers"}, {"Colour", > "Name"}]], > PropertyValue["ColumnModel", Name -> > "COLcolumnModel"], > Script[col = PropertyValue[{"COLcolumnModel", > "Column", 1}]; > > SetPropertyValue[{col, "PreferredWidth"}, 100]; > SetPropertyValue[{col, "MaxWidth"}, 100]; > SetPropertyValue[{col, "Resizable"}, False]] > }, Name -> "ColoursTable"] > > }, Name -> "ColoursPane"], > > "sideBarContent > " -> Widget["WizardHTMLPanel", {"text" -> > "<b>1. Overview</b><p>2. Choose CSV Type<p>3. Select Source > Data<p>4. > Import Options"}], > Script[ > mytestlist = {{"UserName" -> "Euro Dollar Rate 1 Month", > "UserColor" \ > -> Hue[0.0833`]}, {"UserName" -> "Citigroup WGBI -TR USD", "UserColor" > -> Hue[ > 0.333`, 0.613`, 0.55`]}, {"UserName" -> > "MSCI United Kingdom-Net > USD", "UserColor" -> Hue[0]}, {" > UserName" -> "MSCI USA-Net USD", "Order" -> 4, > "UserColor > " -> Hue[0.6`]}}; > > extractTableItems["Colours"] := Module[{f, p}, > sortPerformanceSeriesData["Order"]; > p = mytestlist; > Map[Widget["Icon", { > "data" -> > Script[ExportString[Graphics[{(" > UserColor" /. #), Rectangle[{0, 0}, {1, 1}]}], > "GIF"]]}, Name \ > -> ("UserName" /. #)] &, p]; > Map[{ > WidgetReference[("UserName" /. #)], > ("UserName" /. #)} &, p]]; > > BindEvent[{"myTestPage", "pageWillActivate"}, > Script[ > SetPropertyValue[{"ColoursTableModel", "items"}, \ > extractTableItems["Colours"]]]] > ]}, > > Name -> "myTestPage"] > > GUIRun[Widget["WizardFrame", > {"wizard" -> Widget["Wizard", > {"title" -> "ARC Wizard", > "pages" -> {x}}]}]] > > > This is just an example that includes the piece of coding that doesn't > work. Hoep this is more useful. Hi Paul, I am still investigating this but it seems the problem arises when you try to set the entire table's items at one time as a single matrix from within Mathematica Script code which has to do a conversion of mixed JavaObjects (icons) and native Mathematica types (Strings. Numbers). If you look at your last Script above in your definition: Script[ SetPropertyValue[{"ColoursTableModel", "items"}, extractTableItems["Colours"]] ] and change it to: Script[ itms = extractTableItems["Colours"]; Print[itms]; SetPropertyValue[{"ColoursTableModel", "items"}, itms]; ] You see that the matrix is still a proper mix of JavaObject icons and native data just before you try to set it as the new items on the table model. A current workaround for you is to set the icon cells individually using the InvokeMethod[{"tableModel", "setValueAt"}, obj_, row_, column_] method. A quick way to modify your Script above which sets the icon column cells individually would be: Script[ itms = extractTableItems["Colours"]; SetPropertyValue[{"ColoursTableModel", "items"}, itms]; MapIndexed[ InvokeMethod[{"ColoursTableModel", "setValueAt"}, #1 , #2[[1]] - 1, 0] &, Transpose[itms][[1]]]; ] You will also notice that your Mathematica graphics default to a rather large size so your color cells are somewhat large. You can adjust this by using an ImageSize -> {width, height} option on your call to ExportString. I will let you know what I discover about the initial problem of setting mixed JavaObject and native data items into a table at once using the "Items" property from within a Script block. Jeff Adams Wolfram Research
- References:
- GUIKit - ScrollPane Tables within Wizard
- From: paulw@cwgsy.net
- Re: GUIKit - ScrollPane Tables within Wizard
- From: paulw@cwgsy.net
- GUIKit - ScrollPane Tables within Wizard