Current Page: NeXtMidas Training Macros - Part 1 (Basics) Messages in a Macro Lab 2 - Macro Messages Instructions
- - - | 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.