• Lab 1 - Macro Graphics (Part A):
    • This lab will have you create a NeXtMidas GUI from a macro. It will be a simple GUI with just five controls in it, so don't get worried.
    • First create a new macro called graphicslab1 and add it to the TRAIN option tree.
    • The macro will not take in any parameters so you can add it to the command dictionary at any time.
    • Inside the macro create a new pipe section.
    • Inside the pipe section add a line to bring up a PANEL; you will want to use the /CONTROLS=GC switch with PANEL.
    • Just after creating the panel you will need to add five controls.
      1. A BUTTON named STATE with no title and a single button "Stop".
      2. A CALENDAR named DATE.
      3. A LVAL named YEAR (min=2000, max=2100).
      4. A LVAL named MONTH (min=1, max=12).
      5. A LVAL named DAY (min=1, max=31).
    • 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"
      return
    • Now try running your macro, it should look something like this:
      screen shot of how Macro Graphics Lab 1 should look like
      Take note of the messages received when you click on things.
  • Lab 1 - Macro Graphics (Part B):
    • Now its time to fill in the processMessage procedure.
    • When the user clicks the "Stop" button the macro should stop. You can do this by calling PIPE STOP.
    • When the user clicks on the graphical calendar, you need to update the year, month, and day widgets to match the date the user selected.
      • The date selected is in the data field of the message.
      • You will need to use SEDIT to parse the date (we did something like this back in Lab 1 - Macro Procedures).
      • You can make the output of SEDIT set the value of each of the widgets.
      • Hint: Remember adding the /CONTROLS=GC back in Part A? That was so that we can use GC.<name>.VALUE to set the values of the widgets.
    • When the user updates the year, month, or day fields you will need to update the calendar to match.
      • For this you will need to INVOKE the setDate(year,month,day) method in the calendar widget.
      • Hint: This time use GC.<name>.VALUE to get the values of the widgets.
      • Hint: Since all three LVAL widgets end up calling the same code, you might want to write the code once and make use of the OR in your IF.
      • Prior to NeXtMidas 2.3.0 there was a bug in setDate(..) that caused the month to be computed incorrectly.
    • Finally, if you get a message that doesn't match any of the above, you should print out a message saying you got an "Unhandled message".
  • Hint:
  • Lab 1 - Macro Graphics (Part X):
    • This is not actually part of the lab...
    • If you finish the lab quickly, here are a few things you might want to consider adding to your macro:
      • If the user selects a date that is invalid (such as "April 31"), alert the user using POPUP.
      • Hint: A procedure that computes leap years might be helpful.
      • Add a text field control. When the user changes the date update the control to include the date.