Re: Weird palette stuff, still learning...Help!
- To: mathgroup at smc.vnet.net
- Subject: [mg99867] Re: [mg99852] Weird palette stuff, still learning...Help!
- From: John Fultz <jfultz at wolfram.com>
- Date: Sat, 16 May 2009 18:25:34 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Sat, 16 May 2009 05:20:51 -0400 (EDT), meitnik wrote: > hi, > > Ok, when I use my large, rich palette via CreatePalette, it just works > fine. All my dynamic stuff works, all my ActionMenus work too. But > once I save the palette and use it 'standalone' after relaunching > Mathematica, it breaks. Dynamic fails and some of the ActionMenus are > not firing when selected. Now, if I evaluate all the key cells from > its source notebook while the broken palette is up, it gets "healed" > and works fine. Please explain to me how coding for a palette works so > all its notebook code fires correctly. Frustrated. Thanks for anyone > to restore my sanity. ;-) Your palette is depending upon state that you've loaded in the kernel, such as global variables/function definitions or packages that need to be loaded. You need to initialize this state within constructs in the palette. A typical way to do this would be to use the Initialization option of DynamicModule. Any code you put in the Initialization option (which should use a RuleDelayed, recall...not a Rule) is guaranteed to run before anything in the contents of that DynamicModule. -John