to the bottom of SampleWindowTemplate at tiddlywiki.com , and then run this launch code from a tiddler:
<$button>Open Window
<$action-sendmessage
$message="tm-open-window"
$param="$:/temp/openme"
template="SampleWindowTemplate"
windowTitle="My Window Title"
width="640"
height="480"
something="This is my new window. There are many like it, but this one is mine." />
</$button>
This code was taken from tiddler WidgetMessage: tm-open-window, but don’t use it’s launch bottom there – it doesn’t do anything! (which is another issue).
When the window launches, it will not contain the results of the inserted macro code.
In order to get the macros to work, you have to import them at the top of the template. Which is unexpected for global macros, at least to my way of thinking.
What a surprise. I just stumbled upon the same problem. I also noticed: If I open a window by the menu (Open in new Window) my procedure is called as expected without importing.
Definitely not a bug. When you don’t specify a template, the core default template is used ($:/core/templates/single.tiddler.window) which imports all globals.
If you specify your own template, you then have complete control over whether globals are imported or not. If you want globals available in your template, just add this pragma:
But unexpected, right? Because we don’t need this step when using other templates (e.g. list widget) and because it’s not documented. I was not previously aware that there was any way to create a variable-free environment (though why I would ever want this is unclear).