Use of RuleDelayed in PaneSelector
- To: mathgroup at smc.vnet.net
- Subject: [mg91104] Use of RuleDelayed in PaneSelector
- From: "Eugene Kirpichov" <ekirpichov at gmail.com>
- Date: Wed, 6 Aug 2008 05:05:56 -0400 (EDT)
I'm trying to implement a potentially infinite GUI tree control using
PaneSelector's and Opener's.
The issue is that I use RuleDelayed in the PaneSelector's first
argument to make the contents of panels lazy, so that the contents
would be constructed only when the corresponding panel is activated.
For example:
{Toggler[Dynamic[x]], PaneSelector[{False -> "Inactive", True :>
Print["Activated!"]}, Dynamic[x]]}
I want this to produce a widget that prints "Activated!" each time x
transitions to True. However, all I get is an expression
Print["Activated!"].
If I wrap it into Evaluate[], I get "Activated!" printed immediately
and only once.
How should this code be written to satisfy the condition above?
...OK, perhaps is a 'potentially infinite GUI tree control' already
written somewhere in the standard library? :)
--
Eugene Kirpichov
Web IR developer, Yandex