GDexIndex.gif Previous-2.gif Next-3.gif

Adding to a view's pull-down menus (CreateViewCmds)


In this tutorial, we will add entries to the pull-down menu on the view's window.

Here is the basic structure of a command list. In the diagram, the command list is connected to UIshell, which defines the application's window:

 

GENERATE/FH413283.gif

Here is an illustration of what the resulting menu bar might look like:

 

GENERATE/fh031313.gif

This is just one of many possible configurations. For example, you can connect multiple UIcmdList objects to the UIcmdList that creates the menu bar. This gives you a menu bar with multiple items on it. You can use other UI objects in addition to UIcmd. For example, another UIcmdList object creates a cascading pull-down menu. A UIoption object creates a pull-down command that works like an option box.

Starting up

  1. 1.      Start AVS/Express and choose Single-window DataViewer with no viewer (select None as the Viewer type) from the startup dialog, from an existing AVS/Express session, start a new Single-window DataViewer with no viewer by selecting the appropriate entries from the File->New Application... dialog, or clear an existing SingleWindowApp workspace, as appropriate.
  2. Create a window and a view

    We create the application's window and view with the application component Uscene3D.

    Instance into the SingleWindowApp workspace the object Uscene3D. Uscene3D can be found in Libraries.Accessories.Graphics.Modules.

    When we instance Uscene3D, a black window appears inside the SingleWindowApp. This is where the data is rendered.

    Create view and light editors

    We want our application to have view and light editors that pop up when the user selects the appropriate pull-down command. For this tutorial, we create the editors using the application components Uview_editor and Ulight_editor. Each defines an edit object and a complete user interface (panel, sliders, buttons, etc.) for the editor. We will look at editors more closely in a later tutorial.

    Instance Uview_editor and Ulight_editor, then connect them to the other objects, as shown in the diagram below. When the editors are instanced, the UIcmd contained in the editors is automatically installed on the Editors pull-down menu.

     

    GENERATE/FH649342.gif

    Select the Editors->View and Editors->Light pull-down commands.

    Notice that selecting a command displays its associated editor.

    Create an object and generate field data

    Finally, we need a Graphics Display Kit object with field data. We can create both with Read Geom, using the second output port.

    Instance Read Geom and connect it to Uscene3D, as shown in the diagram below.

     

    GENERATE/FH267381.gif

    We are now ready to specify a data file. In the SingleWindowApp window, select the Editors->Modules pull-down command. The user interface for Read_Geom will appear. Select thr browse button. A dialog box appears. Select teapot.geo, then select the OK button.

    The application renders the teapot in the view's window.

    Select Editors->Light and try the light editor.

    The light editor is connected to the view, so, for example, when we turn the ambient light off, the view is updated accordingly.

    Clean up

    This completes the tutorial. The completed tutorial is available in Libraries.Examples.Graphics_Display.CreateViewCmds.

    Delete the application.

     



    GDexIndex.gif Previous-2.gif Next-3.gif