[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   sf_menu_init          Menu functions/procedures
------------------------------------------------------------------------------

    function long sf_menu_init prototype

    procedure sf_disable_menus prototype

    procedure sf_enable_menus prototype

    procedure sf_menu_add prototype
      parameters value long menu_number,;
                 const char menu_element,;
                 value int  menu_row,;
                 value int  menu_col,;
                 value int  menu_std,;
                 value int  menu_enh

    procedure sf_menu_clear prototype
      parameters value long menu_number

    function uint sf_menu_display
      parameters value long menu_number,;
                 value int  menu_type,;
                 value int  enhanced_std,;
                 value int  enhanced_hi,;
                 value int  window_color,;
                 value int  initial_highlight,;
                 const logical return_on_key,;
                 const logical on_key_do,;
                 untyped do_program

    function uint sf_master_display
      parameters long master_array[ 0 ],;
                 value int max_elements,;
                 value int enhanced_std,;
                 value int enhanced_enh,;
                 value int window_color

    This series of CUA menu functions/procedures allow the programmer to
    construct an @...PROMPT, MENU TO... type menu system in CUA.  The
    SF_MENU_INIT() and SF_MENU_CLEAR() operate exactly like PICK_INIT()
    and PICK_CLEAR().  SF_MENU_ADD() accepts the row/col and color
    specifications for the given prompt.

    In calling the SF_MENU_DISPLAY() function, which returns the menu
    element, you must pass the long menu_init() return, the #define menu
    type, the enhanced standard color, the enhanced  color, the window_color,
    the initial element to highlight, a logical if the menu should return
    if a non-valid key is pressed,a logical for whether or not you wish to
    call a sub procedure upon any keypress and the name of the sub procedure.
    Additionally, if you pass the enhanced standard color as -1, a true
    shadow will be used for the highlight.

    The SF_MASTER_DISPLAY() function returns the following:

       return( ( sub_menu_number * 10 ) + selected_element_number )

    The master menu function allows the passing of a long array of
    SF_MENU_INIT() returns and creates a full pulldown menu system.  This
    is currently a closed function!  In other words, for the time being,
    the function is pre-set to handle the selection process.  This will
    be updated in time.  Of course, as with all CUA objects, full CUA mouse
    support is automaticly added.

    The SF_DISABLE_MENUS() and SF_ENABLE_MENUS() allows the programmer to
    cancel a menu.  You would most likely do this via an ON KEY DO...
    setup.

    Full example: THERE ARE SOME IMPORTANT NOTES IN THIS CODE!!!

        procedure force_main
          vardef
            long sub_menu0, sub_menu1, sub_menu2, sub_menu3
            long master_array[ 4 ]
          enddef
          on error do sf_cua_error_proc
          sf_cua_font()
          sf_vgacua_palette()
          sf_mopen()
          sf_mdelay( 10000 )

          sub_menu0 = sf_menu_init()
          sub_menu1 = sf_menu_init()
          sub_menu2 = sf_menu_init()
          sub_menu3 = sf_menu_init()

          *\ This is the top bar of the master menu. As you will see,
          *\  it is also the first item in the array.
          sf_menu_add( sub_menu0, "Menu1", 02, 05, -16, -7 )
          sf_menu_add( sub_menu0, "Meu2", 02, 30, -16, -7 )
          sf_menu_add( sub_menu0, "Men3", 02, 60, -16, -7 )

          *\ For these submenus, be sure that they are added in row order.
          *\  The menu system uses this order to determine the window
          *\  coordinates.
          sf_menu_add( sub_menu1, "This is choice number 1", 10, 05, -16, -7 )
          sf_menu_add( sub_menu1, "This is choice number 2", 11, 05, -16, -7 )
          sf_menu_add( sub_menu1, "Latest                 ", 12, 05, -16, -7 )

          sf_menu_add( sub_menu2, "This is choice number 3", 10, 30, -16, -7 )
          sf_menu_add( sub_menu2, "This is choice number 4", 11, 30, -16, -7 )
          sf_menu_add( sub_menu2, "This is choice number 5", 12, 30, -16, -7 )

          sf_menu_add( sub_menu3, "This is choice number 6", 10, 50, -16, -7 )
          sf_menu_add( sub_menu3, "This is  ice number 7", 11, 50, -16, -7 )

          *\ Build master menu array
          master_array[ 0 ] = sub_menu0
          master_array[ 1 ] = sub_menu1
          master_array[ 2 ] = sub_menu2
          master_array[ 3 ] = sub_menu3

          ? sf_master_display( master_array[], 4, -1, 0, &CUA_BWHITE )

          sf_menu_clear( sub_menu1 )
          sf_menu_clear( sub_menu2 )
          sf_menu_clear( sub_menu3 )

          wait

          sf_mclose()
          sf_standard_font()
          sf_standard_palette()
        endpro

See Also:
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson