Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Using LevenbergMarquardt Method with a complicated function
  • Next by Date: Re: Re: All Factors of a number
  • Previous by thread: Re: GUIKit - ScrollPane Tables within Wizard
  • Next by thread: Re: GUIKit - ScrollPane Tables within Wizard