MathGroup Archive 2009

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

Search the Archive

Re: Joust in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98341] Re: Joust in Mathematica
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Mon, 6 Apr 2009 05:03:45 -0400 (EDT)
  • References: <gr21m6$lr4$1@smc.vnet.net> <gr4jqm$ag6$1@smc.vnet.net> <200904040117.UAA26673@smc.vnet.net> <gra1og$2h8$1@smc.vnet.net>

Hi,

> I can't see a way of showing lines for the joust 
> (i.e. a sideways tree) but can easily forgo that 
> at this stage. The open - closed carret is presumably
> just displaying and hiding a Cell so in principel
> I could place a graphic at the start followed by a 
> hyperlink or expression.

I don't know joust at all, but if I correctly understand what you are
after, you just could place Row[]-Expressions within the Buttons, I have
enclosed an example in the code below. The carrets are not
displaying/hiding cells, they are just part of OpenerView-Expression
which will be transformed to  PaneSelectorBox-es (and some more) as you
can see when looking at the underlying output expressions. Using these
low level constructs it would probably even be possible to use different
graphical representations than the carrets, but I don't see much value
in that...

> In principle, we would 
> be able to create something far more useful than 
> the Joust.

yes, at least within the Mathematica context, of course it would address
a different class of problems/documents than joust (and e.g. not run in
a browser...).

> At first I was simply thinking of using 
> it for navigation much in the same way that the
> Help Menu works, but there seems to be an opportunity
> to create something with more intelligence built in.
> At this stage I am just scouting for ideas and trying
> to avoid heading down the wrong track.

If you look for further ideas you might have a look at tiddly wiki which
is characterised as a nonlinear notebook somewhere. I think that
something like that, where information not (only) is available through
the structure that the author originally had in mind would also be
something to be very useful in Mathematica Notebooks. It would probably
take somewhat more effort to program something like that, but sometimes
with a good idea it turns out to be easier than originally thought...

> The use of Head to frame the tree was certainly less than 
> obvious!

... but it is by no means of any relevance, of course you can create a
function that works on any other structure which can be interpreted as a
tree expression...

> I would have expected a nested list - something like
> 
> {Continent, 
> {Europe, { UK, Germany, Spain, France...}}, {America,{ Argentina, Brazil, Peru, .....}}, {Asia,..{}}, {Australia....{}}, {Africa...{}}}

... nested lists, (Symbolic) XML, ... you would just need to change some
definitions. Here is a version that understands nested lists of rules (a
common and useful format within Mathematica code) and shows formatted
rows in the outline. Since precreating all the content in this case
takes several seconds on my machine I have also changed the code so that
the Columns will only be created on the fly when opening one of the
OpenerViews, which is achieved with a simple additional Dynamic:

Moust[outline_, content_, icon_] := CreateDialog[{
   DynamicModule[{
     widthleft = 150, widthright = 600, height = 400,
     selectedkey = Level[outline, -1][[1]], outlineview
     },
    Dynamic[
     Row[{
       Panel[Pane[
         outlineview[outline],
         ImageSize -> Dynamic[{widthleft, height},
           (
             height = #[[2]];
             widthright = widthright + widthleft - #[[1]];
             widthleft = #[[1]];
             #
             ) &],
         Scrollbars -> True
         ]
        ],
       Panel[Pane[
         Dynamic[content[selectedkey]],
         ImageSize -> Dynamic[{widthright, height}, (
             height = #[[2]];
             widthright = #[[1]];
             #
             ) &
           ],
         Scrollbars -> True, Alignment -> {Center, Center}
         ]]
       }]
     ],
    Initialization :> (
      outlineview[key_] := Button[Row[{
          Style["\[KernelIcon]", Gray], Spacer[5],
          Show[icon[key], ImageSize -> {Automatic, 10}],
          Spacer[5], key
          }],
        selectedkey = key, Appearance -> None
        ];
      outlineview[rule_Rule] :=
       OpenerView[{rule[[1]],
         Dynamic[Column[outlineview /@ rule[[2]]]]}];
      )
    ]}
  ]

outline = "World" -> Map[
    (# -> CountryData[#]) &,
    {"Europe", "Asia", "NorthAmerica", "SouthAmerica", "Africa"}
    ];

Moust[outline, CountryData[#, "Shape"] &, CountryData[#, "Flag"] &]

> I can appreciate Davids point about making money using Mathematica.
> I've been slowly introducing Mathematica 7 into my daily work flow
> after having given up on it for nearly a decade. The last time I used
> it seriously was in 2000!! The current bottleneck seems to be graphics
> speed.

I think David is correct about his remarks with making money using
Mathematica. My experience is that it is possible when focusing on the
content you provide and probably not even mention the fact that your
deliverables are based on Mathematica, but there is hardly a real market
for Mathematica consultancy per se at this time (it could be possible in
finance, but that's not a field I know very well, and the question is
whether you want to depend on money spent for financial mathematics at
these times :-). I'm undecided whether that has to do with Mathematicas
standing to merely be an academic tool with only special usages in
industry compared to other tools which are considered "industrial
strength standards" and if/how WRI could/should help to change that.
>From my point of view the product as such would basically be as
"industrial strong" as needed, but obviously not its standing/image. My
feeling is that changing the image in that respect is just not at WRIs
(Stevens?) highest priority, probably just not amazing enough in respect
to content compared to NKS, Wolfram Alpha and what else might be on
their/his mind...

And yes, if you want to donate for the above code, I'm happy to provide
you with the necessary information :-)

hth,

albert


  • Prev by Date: Re: Re: Can nobody help me? Re: selecting a column in a grid
  • Next by Date: RE: Re: Can nobody help me? Re: selecting a column in a grid
  • Previous by thread: Re: Re: Joust in Mathematica
  • Next by thread: Re: Joust in Mathematica