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!

IIF() Function in FPW menu designer

Status
Not open for further replies.

dataccount

Programmer
Sep 19, 2001
39
US
Is it possible to use the IIF() function with the FPW26a menu designer for text in the "prompt" or "message"?

Using the DEFINE MENU and DEFINE BAR commands the following code allows me to change the popup bar text and message based on whether "archview" evaluates to true:

DEFINE BAR 1 OF otpop1 PROMPT iif(archview,&quot;\<Switch To Active &quot;, ;
&quot;\<Switch To Archives&quot;) message ;
iif(archview,&quot;Return To The Active Records&quot;, ;
&quot;View Archived Records In Same Screen Format As Active Records&quot;)

I have not been able to do this using the menu designer. It doesn't even work after manually modifying the &quot;.mpr&quot; file by removing the extra leading and ending quotations.

Any help would be appreciated, since I am committed both to using the Menu Designer and switching to VFP. Thanks.

Jim
 
Jim,
I don't believe that will work. I found this routine (actually only part of it is shown), that toggles the clock running on screen. It changes the Menu prompt - just in case the user can't tell what they can do!
Code:
PROCEDURE togclock
* Called from the Menu
PRIVATE lcsvalias, lconoff, lcprompt, lcpopup, lnbar

if !SET('CLOCK')='OFF'
   set CLOCK OFF
   lconoff = &quot;OFF&quot;
else
   set CLOCK STATUS
   lconoff = &quot;ON&quot;
endif
*... Code to save off setting for user next time they start
lcprompt = 'Show clock - '+lconoff

lcpopup = popup()
lnbar = BAR()

RELEASE BAR lnbar OF (lcpopup)

DEFINE BAR lnbar OF (lcpopup) PROMPT lcprompt BEFORE lnbar+1 ;
	MESSAGE 'Set visible clock on/off' SKIP FOR isediting

ON SELECTION BAR lnbar OF (lcpopup) DO togclock

RETURN

Only variants of this are going to allow you to change the Prompt in any current version of FoxPro / VFP. When you need to RELEASE / DEFINE a BAR not from the Menu, you'll need to use the Menu oriented functions like GETPAD(), GETBAR(), etc. to get the right values.

Rick
 
Rick,

I could have saved myself a lot of time if I had just accepted your answer. However, I just couldn't believe that the exact same line of code written using DEFINE BAR would not work with the menu generator.

Over the weekend I sat down at the computer determined to find a way of somehow changing the text of a menu bar using macro substitution or whatever.

You're right - it can't be done. What is needed is a MENU REFRESH command. Thanks for your reply.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top