How to Refresh Buttons with .BMP Pictures

ID: Q98927

2.5x 2.6x 3.00 | 2.5x 2.60a

WINDOWS        | MACINTOSH
kbprg

The information in this article applies to:

SUMMARY

To change pictures when you are using bitmap files for buttons, use the SHOW GET command with a PROMPT clause. The syntax of this command is as follows:

   SHOW GET <var>
      [, <expN1> [PROMPT <expC>]]
      [ENABLE | DISABLE]
      [LEVEL <expN2>]
      [COLOR SCHEME <expN3> | COLOR <color pair list>]

NOTE: Even if you have a push button with only one prompt, you must still specify the button number (in this case, 1) after the variable name.

MORE INFORMATION

The following information was extracted from the online Help file:

   You can replace the prompt for an individual push button, radio
   button or check box with another prompt by including PROMPT <expC>.
   <expC> replaces the original button or check box prompt. You can
   also change the button or check box attributes (which determine
   whether the control is enabled or disabled, what hot keys are
   assigned, and whether it is the default or Escape choice) by
   specifying the appropriate special characters with <expC>.

In FoxPro for Windows, you can use PROMPT to specify .BMP files (bitmapped pictures) that are displayed on a picture check box, push button, or radio button when it is enabled, selected, and disabled. In FoxPro version 2.5 for MS-DOS, the PROMPT clause is ignored if .BMP files are specified in the PROMPT clause.

The example that follows shows how to use the SHOW GET command with push buttons, radio buttons, and check boxes. In this example, all .BMP files are in the directory C:\BMP:

   @ 1.750,9.140 SAY "Push Buttons"
   * Defines a push button with a .BMP picture.
   @ 2.750,9.140 GET mpush PICTURE "@*BHN c:\bmp\cars.bmp";
      SIZE 2.100,6.00,1.286 ;
      DEFAULT 0 ;
      FONT "Times New Roman", 12 ;
      STYLE "B" ;
      VALID pushrefr()

   * Defines two radio buttons with a .BMP prompt.
   @ 5.750,9.140 SAY "Radio Buttons"
   @ 6.750,9.140 GET mradio ;
      PICTURE "@*BHN c:\bmp\argyle.bmp; c:\bmp\cars.bmp";
      STYLE "T";
      VALID radrefre();
      DEFAULT 0

   * Defines a check box with a .BMP prompt.
   @ 9.750,9.140 SAY "Check Boxes"
   @ 10.750,9.140 GET mcheck PICTURE "@*cBhn c:\bmp\egypt.bmp";
      STYLE "T";
      VALID checkref();
      DEFAULT 1

   READ CYCLE

   FUNCTION pushrefr && Refreshes the push button
   * At that point, only the first option should be necessary.
   SHOW GET mpush,1 PROMPT  ;
      "c:\bmp\chitz.bmp,c:\bmp\argyle.bmp,c:\bmp\castle.bmp"
   * Refreshes the prompt. Here only the first option is actually used.

   FUNCTION radrefre
   * Refreshes the radio button.
   y="c:\bmp\cars.bmp,c:\bmp\cars.bmp,c:\bmp\cars.bmp"
   z="c:\bmp\argyle.bmp,c:\bmp\argyle.bmp,c:\bmp\argyle.bmp"
   SHOW GET mradio,1 PROMPT y  && Switch prompts for the buttons.
   SHOW GET mradio,2 PROMPT z

   FUNCTION checkref
   * Refreshes the check box.

   SHOW GET mcheck,1 PROMPT "c:\bmp\flock.bmp"

   *: EOF: TEST.PRG

Additional reference words: VFoxWin 3.00 FoxWin FoxMac 2.50 2.50a 2.50b 2.50c 2.60 2.60a @...GET PROMPT KBCategory: kbprg KBSubcategory: FxprgGeneral
Keywords          : FxprgGeneral 
Version           : 2.5x 2.6x 3.00 | 2.5x 2.60a
Platform          : MACINTOSH WINDOWS

Last Reviewed: April 30, 1996