Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide controls in screen 1

Status
Not open for further replies.

Skysurfer72

Programmer
Jul 18, 2001
3
IT
I use FoxPro 2.5.

Is it possibile to hide some controls in a screen?
I need to make some controls in a screen invisible in some case and visible in other case.
How can I do?
Thanks all.
 
Have you tried testing for a logical in the When of the Command Button?
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
It depends a little on what you want to accomplish.
If you don't want the use to use certain buttons/fields under certain conditions, a WHEN clause will do fine since then they wont respond to clicks (though from a user's point of view this can be confusing -- in that case you might want to DISABLE those controls).

If you really want them to be invisible, it depends on whether or not this should be dynamical; in most cases you know what to show before you enter the screen.

In that case it could be interesting to create an empty field that is in object order before the controls you want to hide, and one after those fields.
Then use the 'Comment' button for these two input fields and use the #USERPRECMD preprocessor directive to make GENSCRN put lines of code before and after.

So input field 1 would have a comment like
#USERPRECMD IF hasThisModule
And input field 2 would have a comment like
#USERPRECMD ENDIF

The resulting .SPR code should look something like

@...SAY...
...
IF hasThisModule
@...SAY...
...
@...GET...
...
ENDIF
@...GET...
...

----

However, if after all this, you still need it done dynamically, consider making sub-windows and showing/hiding those conditionally.

Jan Schenkel
"As we grow older, we grow both wiser and more foolish at the same time." (De Rochefoucauld)
 
Thanks Jschenke.
I Tried to use #USERPRECMD but I got nothing in the generated .SPR

Everything i write in Comment section, i never see it in the generated .SPR

I use FoxPro 2.5

Thanks
 
Heh, my mistake; admittedly this is a rather obscure feature of the screen generator so I didn't remember the exact syntax. It must be:

[...]
So output field 1 would have a comment like
*# USERPRECOMMAND IF hasThisModule
And output field 2 would have a comment like
*# USERPOSTCOMMAND ENDIF
[...]

I'm not sure this works in Fox2.5 though; check the code of GENSCRN.PRG and have a look at the #DEFINE lines, it should be #DEFINE c_userprecode [...] and #DEFINE c_userpostcode [...].

Jan.
 
I found nothing in GENSCRN.PRG that seem like PreCode or PostCode.
I think that version 2.5 doesn't support this.
But i have found GENSCRNX.PRG that could resolve my problem.
Thanks a lot.
Skysurfer
 
Hi everyone;

Its been quite some time since I have done a screen in FPW,
most of my work is now in Visual, so please forgive me if I am way off the track or just confusing the issue here.

I think this might work.

When you want your field to be invisible

SHOW GET <field name> DISABLE ;
COLOR(x,x,x,y,y,y)

where x and y match the forms color scheme.


Hope this helps

Ed
 
FoxTalk magazine had an article on this subject several years ago-- you might be able to search their archives at pinnacle publishing.

Chuck Davis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top