Displaying Unique Messages for Prompts in a Button Set

Last reviewed: April 29, 1996
Article ID: Q104347
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY

When you are creating a button set in the Screen Builder with two or more push button prompts, you can have a unique message displayed for each individual prompt when it is activated.

MORE INFORMATION

When a button set is created in FoxPro, a single @ ... GET command is generated, regardless of the number of prompts in the set. Therefore, only a single MESSAGE clause can be used with a button set. However, the MESSAGE clause is reevaluated each time the value of _CUROBJ changes, allowing for the display of unique messages for prompts in the same button set. To do this, declare the MESSAGE clause as either a procedure or an expression. The following code examples demonstrate these methods using a button variable named "choice" with three push button prompts.

MESSAGE Clause as a Procedure

   button_num=(_CUROBJ+1)-OBJNUM(choice)
   DO CASE
     CASE button_num=1
       RETURN "Message text for first button"
     CASE button_num=2
       RETURN "Message text for second button"
     CASE button_num=3
       RETURN "Message text for third button"
   ENDCASE


MESSAGE Clause as an Expression

   choice_msg((_CUROBJ+1)-OBJNUM(choice))

where

   DIMENSION choice_msg(3)
   choice_msg(1)="Message text for first button"
   choice_msg(2)="Message text for second button"
   choice_msg(3)="Message text for third button"

is in the screen SETUP code to define and initialize the choice_msg array.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a window
KBCategory: kbprg kbdisplay kbui kbcode
KBSubcategory: FxtoolSbuilder


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.