Previous Next        Current Page: NeXtMidas Training / Macros - Part 2 (Graphics) / GControls / Getting and Setting
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)   
   + Intro to Graphics   
   - GControls   
      - Types of Controls   
         - Entries/Selectors   
         - Valuators   
         - Popups   
         - Dialogs   
         - Displays   
         - Labels   
      - Getting and Setting   
      - See Also   
   + Lab 1 - Macro Graphics   
   + Plotting and Listing   
   + Panel Setup   
   + Lab 2 - Macro Graphics   
   + Conclusion   
   + Lab 3 - Macro 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   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Getting and Setting Values of GControls:
    • All of the GControls have a .value that can be used from the macro.
    • When the PANEL is created the /CONTROLS=GC switch can be added in.
      • This tells GCONTROL to put a reference for each control into the GC table.
        startmacro
          pipe on
            panel/controls=gc
            
            gcontrol lval mynum "MyNum" 50 0 100 5
            
            res gc.mynum.value
          pipe off
        endmacro
    • When a user changes the value of a GControl, the control sends a message to the macro.
      • This message can be viewed in the processMessage procedure.
        startmacro
          pipe on
            panel/controls=gc
            
            gcontrol lval     mynum "MyNum" 50 0 100 5
            gcontrol calendar mycal 
            gcontrol button   mybtn "My Buttons" "RED,WHITE,BLUE"
          pipe off
        endmacro
        
        procedure processMessage m:msg
          say "Got message name=^msg.name info=^msg.info data=^msg.data"
        return
        
    • NOTE: Certain message names are reserved and have special uses. These names should be avoided when composing messages. Also, since command id's become the message name when interacting with the macro, users should not assign any commands (including gcontrols) an id with one of these reserved names:
         EXIT
         ERROR
         EXEC
         MACRO