Microsoft KB Archive/104347

From BetaArchive Wiki

Displaying Unique Messages for Prompts in a Button Set

ID: Q104347

2.00 2.50 2.50a | 2.50 2.50a

MS-DOS          | WINDOWS
 kbdisplay kbui

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: kbdisplay kbui KBSubcategory: FxtoolSbuilder

Keywords          : kbcode FxtoolSbuilder 
Version           : 2.00 2.50 2.50a | 2.50 2.50a
Platform          : MS-DOS WINDOWS

Last Reviewed: May 22, 1998
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.