Previous Next        Current Page: NeXtMidas Training / X-Midas Interoperability / NeXtOpt / Messages / Translated Messages
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
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   
   + Overview   
   + XBC   
   + Lab 1   
   - NeXtOpt   
      - NeXtOpt Setup   
      - Using NeXtOpt   
      - Shared Functions   
      - Messages   
         - Configured Messages   
         - Unconfigured Messages   
         - Translated Messages   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • "Translated" NeXtMidas Messages:
    • A "translated" NeXtMidas message is one that has been put in the form of a /NM/ message usable in X-Midas.
    • The /NM/ message has the following fields:
      MSG_NAME NeXtMidas message name.
      MSG_INFO NeXtMidas message info.
      MSG_DATA NeXtMidas message data.
      MSG_FID NeXtMidas message from ID. (NM->XM only)
      MSG_TID NeXtMidas message to ID. (NM->XM only)
    • In this case MSG_DATA, is the text form of an XMValue.
    • Due to the way X-Midas messaging works, MSG_DATA can not contain any "live" objects. All objects will be converted to an XMValue-compatible form (string, number, or table) before sending.
    • Conversely messages received from X-Midas will be in a XMValue-compatible form and primitives should use the appropriate Convert methods (e.g. Convert.o2t(..)) rather than casting msg.getData() to a specific object type.
  • Sending messages to NeXtMidas:
    • Sending the messages has the following form:
      message send /NM/ <id> ,, <msg_name> <msg_info> <msg_data>
  • Receiving messages from NeXtMidas:
    • Most NeXtMidas primitives (e.g. PLOT) will send messages if the /MSGID= switch is given. Setting /MSGID=XM.1 will send messages to the X-Midas macro.
    • NeXtMidas /NM/ messages are received similar to other X-Midas messages.
    • Since the MSG_DATA field matches the string form of an XMValue, it is is possible to do the following in X-Midas 4.6 and later:
      res v:data ^{M.nm_msg_data}
    • In X-Midas 4.4, working with MSG_DATA is a little more difficult.
      • It is necessary to filter out messages which have a table for MSG_DATA.
      • Those with a table can be worked with by using RMSG to expand the table, for example:
        rmsg T2R ,,,, M.nm_msg_data "TEMP_"
        res TEMP_*
  • Example:
    startmacro/nmq=8k
      local /M/
      ...
      nm/on/bg/id=999
      xpipe/setup/controls on
        nm/xs=2 plot/id=7/msgid=XM.1 nxm.sys.dat.world.prm
        ...
      xpipe off
      nm/off
    endmacro
    
    startcontrols
      label initialentry
        xcontrol/lab=domenu menu item ,, "MACRO;ZoomAfrica,UnZoom"
        xcontrol/lab=getmsg msmon 1 10
        ...
      return
    
      label domenu
        if item eq 1 then
          message send /NM/ 7 ,, "ZOOM" 0 {XMIN=-20,XMAX=55,YMIN=-40,YMAX=40}
        else
          message send /NM/ 7 ,, "UNZOOM"
        endif
      return
    
      label getmsg
        message get /M/
        if M.name eqs "NM" then
          say "Got NeXtMidas Message:"
          say "  NAME : ^{M.nm_msg_name}"
          say "  INFO : ^{M.nm_msg_info}"
          say "  DATA : ^{M.nm_msg_data}"
          say "  FID  : ^{M.nm_msg_fid}"
          say "  TID  : ^{M.nm_msg_tid}"
        endif
      return
      ...
    endcontrols
    
New Feature (Since NeXtMidas 2.7.1):
New Support for "translated" NeXtMidas messages was added in NeXtMidas 2.7.1. Prior to NeXtMidas 2.7.1 there was minimal support for messaging between existing NeXtMidas primitives (e.g. PLOT) and X-Midas.