Previous Next         Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Lab 10 / Instructions
Start Here   
Background   
Common Midas Concepts   
Getting Started   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
   + Macro Basics   
   + Lab 1   
   + Lab 2   
   + Loops and Control Structures   
   + Lab 3   
   + Lab 4*   
   + Procedures and Subroutines   
   + Lab 5   
   + Lab 6*   
   + Pipes in a Macro   
   + Lab 7   
   + Lab 8   
   + Messages in a Macro   
   + Lab 9   
   - Lab 10   
      - Instructions   
      - Solution   
Macros - Part 2 (Graphics)   
Primitives   
Installing NeXtMidas   
Applets & WebStart   
Mapping (NeXtEarth)   
Remote Midas InterFace (RMIF)   
Using NetBeans   
X-Midas Interoperability   
Remoting an X-Midas App.   


  • Lab 10 (Part A):
    • For this lab we will extend the macro written for Lab 9 to include sending messages to plot.
    • Make a copy of the macro you made in Lab 9 and save it as mcrlab10.mm. The use UPDATE to add the new macro to the TRAIN option tree.
    • In the processMessage add a new check for a zoom message. When you see a zoom message, add the following to print out its data:
          result msg.data(0)
          result msg.data(1)
          result msg.data(2)
          result msg.data(3)
    • Add another check for a MARK message. When you see a mark message, hide the box you were drawing.
      • This can be done by setting x, y, dx, and dy to zero.
    • Try running the macro and notice what happens when you zoom and unzoom.
  • Lab 10 (Part B):
    • Now, if the box is showing, we are going to limit the user to only zooming in if they zoom inside the box.
    • First we need to know if they are inside the box. This can be done by taking the zoom limits and making sure they are all inside the box's limits set by x, y, dx, and dy.
    • For now just print out a message indicating if the zoom is inside the box. If the box is not showing (all values are zero), print out a message saying that it isn't showing.
    • Try running the macro and notice what happens when you zoom and unzoom.
  • Lab 10 (Part B):
    • We are going to prevent illegal zooms (outside of the box) by automaticallu unzooming if any part of the zoom is outsize and the boz is not zero.
    • To unzoom send a message named UNZOOM to the plot using the MESSAGE command.
      • No info= or data= are required.
    • Try running the macro and notice what happens when you zoom and unzoom.