• Lab 1 - Macro Messages (Part A):
    • For this lab you will see how to receive messages in a macro.
    • Create a new macro msglab1 in the TRAIN option tree.
    • In this lab we will be getting messages from a PLOT. In order for the PLOT to stay up and allow the macro to receive messages, it needs to be in a pipe section.
      • In the body of your macro add a pipe section.
      • The first line of the pipe section should look like this:
          pipe on
            panel
        This will bring up a PANEL. The use of PANEL will be discussed in the next section. For now all that is important is that clicking the 'X' in the panel will end the macro. (When the PANEL comes up it will probably be behind the PLOT, so you may need to move the PLOT to see it.)
      • In the pipe section, bring up a PLOT of nxm.sys.dat.world.shp
      • Give the plot an ID of MYPLOT and set the /MSGID=... switch.
    • Part B will cover the details of processMessage procedure. For now just make it print out the message received.
      procedure processMessage m:msg
        say "Got message name=^msg.name info=^msg.info &
             data=^msg.data from=^msg.fid"
      return
    • Now use UPDATE to add your macro to the command dictionary.
    • Run your macro. Take note of the messages printed out when you click on the plot.
  • Lab 1 - Macro Messages (Part B):
    • Now we want to use a FEATURE to mark the location of any "MARK" made by the user.
    • Create a feature on the line right after the PLOT command in the pipe section you can just paste in this code.
      FEATURE label=fea1 table={NAME=FEA1,TYPE=SYMBOL,&
                                COLOR=YELLOW} plot=myplot
      
    • The feature will be located at fea1.x and fea1.y In the processMessage procedure, set the location of the feature to match the "MARK" message received.
      • In the processMessage add a check for a "MARK" message. When you see a "MARK" message set the feature location to match that given in the "MARK" message.
      • Hint: If your data is a "PosLonLatAlt" you can access data.lon, data.lat and data.alt.
    • Now try running your macro and clicking around the map. You should see a yellow 'X' marking the last place you clicked.