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 - popbox() display popup message box with buttons http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 popbox()            Display popup message box with buttons
------------------------------------------------------------------------------
 Declaration
   screen.hdr

 Syntax
   func uint popbox extern
   param value int  iRow, ;
         value int  iCol, ;
         value uint uWidth, ;
         const char cTitle, ;
         const char cText, ;
         const char cButtons, ;
         value uint uAttributes, ;
               byte aColors[ PC_LENGTH ]

 Arguments
   iRow is the top row for display.

   iCol is the left column for box display.

   uWidth is the width of the box (pass 0 for self-sizing).

   cTitle is is the title string.

   cText is the text with lines separated by the ";" character.

   cButtons is the button text string with buttons separated by the
   ";" character. The maximum number of buttons is four.

   uAttributes is the display attributes.

   aColors[] is an array that determine the color of display. Array
   positions are defined in screen.hdr as follows:

   -----------------------------------------------------------------------
   Macro          Value  Meaning
   -----------------------------------------------------------------------
   PC_BOX             0  color of box frame and title
   PC_SELECTED        1  color of selected button
   PC_NONSELECTED     2  color of nonselected button
   PC_HIGHLIGHT       3  color of button hotkey character (foreground only)
   PC_TEXT            4  color of text inside the box
   -----------------------------------------------------------------------

 Return
   The number of the selected button, or 0 if the Escape key was pressed.

 Description
   The popbox() function displays a dialog box with title, message text
   and buttons. The appearance of the display is adjusted by the
   uAttributes parameter, which uses macro constants identical to
   the box3d() procedure, and the following additional constants:

   PB_NOREST                            // no screen restore
   PB_BUTTONSHADOW                      // button shadow

 Example
   #define EXAMPLE_SCREEN
   #include example.hdr

   proc Test_popbox
   vardef
      uint uAttr
      byte aColors[ PC_LENGTH ]
      uint uChoice
   enddef
   box( 0, 0, __max_row, __max_col, replicate( chr( 176 ), 9 ), BLUE_WHITE )
   
   // simple message box
   aColors[ PC_BOX         ] := __syscolor[ CLR_STD ]
   aColors[ PC_SELECTED    ] := __syscolor[ CLR_ENHCD ]
   aColors[ PC_NONSELECTED ] := __syscolor[ CLR_STD ]
   aColors[ PC_HIGHLIGHT   ] := __syscolor[ CLR_ENHCD ]
   aColors[ PC_TEXT        ] := __syscolor[ CLR_STD ]
   uAttr := PB_NOREST
   uChoice := popbox( 2, 2, 0, "", "Hello there", "", uAttr, aColors[] )
   
   // more complex dialog box
   aColors[ PC_BOX         ] := WHITE_WHITE
   aColors[ PC_SELECTED    ] := GREEN_WHITE
   aColors[ PC_NONSELECTED ] := GREEN_BLACK
   aColors[ PC_HIGHLIGHT   ] := BLACK_YELLOW
   aColors[ PC_TEXT        ] := CYAN_BLACK
   uAttr := B3D_SHADOW + B3D_MIXED + B3D_FRAME + B3D_HEADER + PB_BUTTONSHADOW
   uChoice := popbox( 10, 20, 0, "[ Exit ]", ;
      "The Exit key has been pressed.;" + ;
      "Edited documents are in memory.;" + ;
      "Are you sure you wish to quit the application?", ;
      "  &Yes   ;   &No   ;  &Help  ; &Cancel ", ;
      uAttr, aColors[] )
   @ 23, 0 ?? "Returned", uChoice
   wait
   endproc

   proc main
   Test_popbox()
   endproc

See Also: alert() box3d()

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