Clearing Empty User Defined Hook Functions?
jjweimer
switch(how)
case -1: // clear all
SetWindow $cw hook(MyHookA)=$""
SetWindow $pn hook(MyHookA)=$""
SetWindow $cw hook(MyHookB)=$""
SetWindow $pn hook(MyHookB)=$""
break
case 0: // set A active
SetWindow $cw hook(MyHookA)=MyHookAFunction
SetWindow $pn hook(MyHookA)=MyHookAFunction
SetWindow $cw hook(MyHookB)=$""
SetWindow $pn hook(MyHookB)=$""
break
case 1: // set B active
SetWindow $cw hook(MyHookA)=$""
SetWindow $pn hook(MyHookA)=$""
SetWindow $cw hook(MyHookB)=MyHookBFunction
SetWindow $pn hook(MyHookB)=MyHookBFunction
break
endswitch
case -1: // clear all
SetWindow $cw hook(MyHookA)=$""
SetWindow $pn hook(MyHookA)=$""
SetWindow $cw hook(MyHookB)=$""
SetWindow $pn hook(MyHookB)=$""
break
case 0: // set A active
SetWindow $cw hook(MyHookA)=MyHookAFunction
SetWindow $pn hook(MyHookA)=MyHookAFunction
SetWindow $cw hook(MyHookB)=$""
SetWindow $pn hook(MyHookB)=$""
break
case 1: // set B active
SetWindow $cw hook(MyHookA)=$""
SetWindow $pn hook(MyHookA)=$""
SetWindow $cw hook(MyHookB)=MyHookBFunction
SetWindow $pn hook(MyHookB)=MyHookBFunction
break
endswitch
The hooks are attached to a panel that is external to a graph and to the graph. I notice, when I save the experiment and then reopen it, I get a compilation error. Essentially, the panel window recreation line contains code ...
SetWindow kwTopWin, hook(MyHookA)=MyPanel#
SetWindow kwTopWin, hook(MyHookB)=MyPanel#
SetWindow kwTopWin, hook(MyHookB)=MyPanel#
This causes the experiment recreation to bomb.
So, how do I clear the user defined hooks and not leave empty traces of them in the window recreation macro for the experiment?
My initial bet is that there's a bug in how Igor fixes up hook function names in an independent module (is that what "MyPanel" is?
In other words, I suspect you really have
...
SetWindow $cw hook(MyHookA)=$""
You'll also help by pointing out which version of Igor you're using.
Software Engineer, WaveMetrics, Inc.
July 29, 2009 at 05:50 pm - Permalink
Will do. Thanks!
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
July 30, 2009 at 05:49 am - Permalink
Software Engineer, WaveMetrics, Inc.
July 30, 2009 at 05:52 pm - Permalink