Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - menusetmessage() define a prompt's message http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 menusetmessage()    Define a prompt's message
------------------------------------------------------------------------------
 Declaration
   menu.hdr

 Syntax
   func logical menusetmessage extern
   param value _MENU pMenu, ;
         value int   iId, ;
         const char  cMessage

 Arguments
   pMenu    is the pointer to a previously created menu system. If 0, the
            default menu will be used.
   iId      is the id number of the prompt.
   cMessage is the new message to be assigned.

 Return
   A logical indicating the success of this function. If .t., the new
   message could be assigned, if .f., an invalid menu pointer was specified,
   or the specified prompt is not available in the menu.

 Description
   This function assigns a message text in cMessage to the promt specified
   with the iId argument. Whenever that promt becomes current, the associated
   message will be displayed at the screen position for messages with the
   color attribute specified in the __syscolor[ CLR_MESSAGE ] array element.

   The message text is automatically right-padded with blanks to a total
   length corresponding the longest message text defined in the menu, so
   there is no need to define all messages with the same length in order
   to maintain a "nice-looking" message area.

   The set message to command, and the setmessagecol() procedure can be used
   to define the screen position for message output. By default, messages
   are originated at row 24, column 0.

 Example
   #define EXAMPLE_MENU
   #include example.hdr

   proc Test_menusetmessage
   vardef
      _MENU pMenu
      uint  uKey
   enddef
   
   cursor( .f. )
   clear
   
   pMenu := menunew()
   
   menupromptnew( pMenu, 2, 10, " Option 1 ", 1, .t., .t. )
   menupromptnew( pMenu, 3, 10, " Option 2 ", 2, .t., .t. )
   menupromptnew( pMenu, 4, 10, " Option 3 ", 3, .t., .t. )
   menupromptnew( pMenu, 5, 10, " Option 4 ", 4, .t., .t. )
   
   menusetmessage( pMenu, 1, "This is message 1" )
   menusetmessage( pMenu, 2, "This message belongs to option 2" )
   menusetmessage( pMenu, 3, "Hi, I'm message 3" )
   menusetmessage( pMenu, 4, "I`m the 4th and last one." )
   
   @ 9, 10 ?? "Press Up/Down to navigate, Esc to quit"
   set message to 7
   setmessagecol( 10 )
   do while .t.
   
      menudispmessage( pMenu )
      uKey := getkey()
   
      do case
      case uKey == K_DOWN
         menusetnext( pMenu )
      case uKey == K_UP
         menusetprev( pMenu )
      case uKey == K_ESC
         exit
      endcase
   
   enddo
   
   menuclear( pMenu )
   cursor( .t. )
   clear
   
   endproc

   proc main
   Test_menusetmessage()
   endproc

See Also: menusetprompt() set message to

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson