Previous Next        Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Messages in a Macro / Lab 2 - Macro Messages / Instructions
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
   + Macro Basics   
   + Loops and Control Structures   
   + Procedures and Subroutines   
   + Pipes in a Macro   
   - Messages in a Macro   
      - Message Queue   
      - Message Structure   
      - Sending Messages   
      - Receiving Messages   
      - Processing Messages   
      - Lab 1 - Macro Messages   
         - Instructions   
         - Solution   
      - Lab 2 - Macro Messages   
         - Instructions   
         - Solution   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 2 - Macro Messages:
    • For this lab we will extend the msglab1 macro written for the previous lab.
    • Copy of the msglab1.mm to msglab2.mm. The use UPDATE to add the new macro to the TRAIN option tree.
    • This lab will not use a FEATURE so delete the line creating the feature and delete the part of processMessage where you set the position of the feature. (Do not delete the check for the "MARK" message, you will be using it again.)
    • This time when you get a mark message you are going to send a "ZOOM" message to the plot and zoom it in by 50% (e.g. if the current width is 360° the new width will be 180° centered on the point the user clicked).
      • You can get the current bounds from the plot using:
        res reg.myplot.x1
        res reg.myplot.x2
        res reg.myplot.y1
        res reg.myplot.y2
      • If you check out the explain file for PLOT, you will see that it takes in a "ZOOM" message with the data set to {XMIN=,XMAX=,YMIN=,YMAX=}. This is the message you will need to send to the PLOT (note that you can use INFO=0).
      • You will need to compute the new bounds for the PLOT. It should be half the width and height of the current plot and should be centered on the point specified in the data of the "MARK" message.
    • Try running the macro and notice what happens when you click and unzoom.