|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon May 12, 2008 6:51 pm
[2.25] Bug with macros and module scope |
- Open some test session (can be untitled one).
- Create module in main package, next to session window object, using this XML:
Code: |
<module name="Persistent" global="true" id="1">
<uid>{99F8498D-FDC0-4AD2-A380-0D1A5A16ED22}</uid>
<class name="Vars" id="2">
<var name="target_lists" type="Record" id="3">Person="Jack|Jill|Bob|Mary"|Mobile="fisher|rockeater|moose"</var>
<var name="target_mode" id="4">Mobile</var>
</class>
</module>
|
Create a test package, using the following XML for the module:
Code: |
<module name="Test1" global="true">
<uid>{1A4CB778-87A7-4DBC-8F6D-B1EAE70E0592}</uid>
<class name="Test1" id="1">
<func name="targets" id="2">
<value>#RETURN %db(@target_lists, @target_mode)</value>
</func>
<macro key="ALT-CTRL-UP" id="3">
<value>#SHOW "Targets: "@targets()</value>
</macro>
<alias name="tq" id="4">
<value>#SHOW "Targets: "@targets()</value>
</alias>
</class>
</module>
|
At the command line, use TQ to show the list of targets, and you should see "Targets: fisher|rockeater|moose" displayed.
Use the Alt-Ctrl-UpArrow macro, however, which executes the same code, and you'll see just "Targets: " instead of the actual list.
In the options for your Test1 module, check the main session package to enable it. You'll find that the macro now shows the list of targets.
I'd like for the macro behavior to be the same as the alias behavior, please.
P.S. This doesn't just apply to functions or variables. I also raise an event from my macro, and that, too, used the wrong scope rule. I have to enable the handler module for the raising module, and that breaks my model! |
|
Last edited by Larkin on Tue May 13, 2008 11:43 am; edited 1 time in total |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue May 13, 2008 7:53 am |
Confirmed.
|
|
_________________ Asati di tempari! |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri May 30, 2008 12:44 am |
Is this on the list Zugg?
|
|
_________________ Taz :) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri May 30, 2008 4:37 pm |
Missed this one, but have added it to the bug list. Thanks for the bump.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 02, 2008 9:05 pm |
I am having trouble reproducing this one, so maybe it's already fixed in v2.26. When I pasted your two modules and then tried the "tq" alias and the alt-ctrl-up macro, both worked fine. When I clicked on the Test1 module, the "untitled" main window was already checked (and in fact it is shown in gray text and disabled so that you cannot uncheck it). So I'm confused by your step number 6.
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon Jun 02, 2008 9:12 pm |
There's a Window (untitled) and a Module (Persistent), both in the untitled package tab. Are you putting the variables under the window directly? I pasted the XML to make it easier to recreate the settings just as I have them, but I could see where the instructions might throw you off just a little...
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 02, 2008 9:17 pm |
Oops, OK. I missed the part where the "Test1" module needed to be pasted into a different package. I had it in the untitled package too. Now that I followed the instructions correctly, I have reproduced the problem.
I also noticed that when pasting these modules into CMUD, they are marked as "Local" instead of "Global", even though the XML says "Global=true". Maybe that is something new in 2.26, but I need to fix that too.
Edited: OK, found both of these bugs and have them fixed for 2.26. |
|
|
|
|
|