How to Create Disappearing GETs in FoxProID: Q128207 2.60a WINDOWS The information in this article applies to:
SUMMARYThis article shows by example how to offer a GET object for selection only after specific criteria are met, preventing the selection and display of the GET object at all other times. Although a simple WHEN test controls selection of a GET object, it does not prevent the user from viewing it if the condition is not met. In the case of input fields, the disabled colors can be set to the same colors as the background screen, causing it to effectively disappear. Unfortunately, this technique won't work for buttons and popups, and disabling the GET does not prevent the button or popup object from appearing on the screen in dithered colors.
MORE INFORMATION
Step-by-Step ExampleThe following code demonstrates how to define objects in Screen Builder that through sleight-of-Hand give the appearance of disappearing and re-appearing on command. The example demonstrates how to hide the GET object when the screen is initially displayed, and then reveal it in response to a push button. 1. Issue the following to create a new screen:
2. Pick Layout from the Screen menu pad. Then choose the Color... button.
3. Set the background to light gray. Then click OK twice to return. 4. Add a push button in the lower center of the screen. 5. Enter the following as the push button Prompt:
6. Name the variable hocus.
7. In the VALID clause, add the following code:
8. Add another push button in the upper center of the screen.
9. Enter the following as the push button Prompt:
10. Name the variable pocus.
11. Mark it as Initially Disabled. 12. In the WHEN clause, enter this command:
13. Surround the Abracadabra push button with a Box object.
14. While the Box is selected, choose Object from the menu. 15. Select light gray for Fill color and also for Pen color. 16. Generate the screen. Then open the .SPR as shown:
17. Locate the line in the Screen Layout section of the .SPR file that
18. Highlight the entire statement. Then copy it by pressing CTRL+C or by
19. Close the .SPR file. Then execute the MODIFY SCREEN MAGIC command.
20. Under Screen Layout, choose Code... and select On Refresh. 21. Select the procedure box. Then paste the code by pressing CTRL+V or by 22. Regenerate the screen. Close the .SCX file and execute the DO MAGIC.SPR
To test the effect, click the 'Prest-o!!' button to cause the hidden button
to appear. Click the 'Abracadabra!' button. Then click the 'Change-o!'
button to cause the button to vanish. Then click where the other button was
to show it is no longer accessible.
Additional reference words: FoxWin 2.60a KBCategory: KBSubcategory: FxprgGeneral
|
|
Last Reviewed: May 22, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |