Using @menu Problem
Bruce Easton
bruce at stn.com
Fri Aug 28 10:47:05 PDT 2009
Harold wrote:
>
> Kenneth Brody wrote:
> > Harold wrote:
> > [...]
> >> The problem is that when I use @menu the program fails
> when it hits
> >> the line of code that has "screen 1,20." When the program
> hits that
> >> line, the cursor goes to the center bottom of the screen, in the
> >> "Enter Selection >" area and is hung up.
> > [...]
> >
> > You are not in update mode when in @MENU processing. You
> need to go
> > into update mode first, and take it from there. While there are
> > numerous ways to do this, an easy way is to have your @MENU
> processing
> > do PUSHKEY "U" and END, and then continue what you want to do in
> > @UPDATE processing.
> >
>
> Hi Ken,
>
> Thanks for your reply.
>
> I tried what you suggested and put in "pushkey "u";end." It
> worked, but up popped Enter "Index Search Data" that I am
> trying to avoid. I want to have the screen show an input
> popup, such as:
>
> input popup ("5","5") na "To Add A New Shipmate Enter 3 OR 4
> Letters Of Last Name"
>
> How do I not use the filepro input popups?
>
> Harold
>
Harold - try the following as an input table to see the
effect of the pushkeys. Then tailor to your needs.
1 ------- - - - - - - - - - - -
If: @cd eq ""
Then: cls("22"); ms="Record Saved - Add Another"
2 ------- - - - - - - - - - - -
If: @cd eq ""
Then: errorbox ms, "\r Y \r-Yes \r N \r-No", "YN"
3 ------- - - - - - - - - - - -
If: @cd eq "" and @bk ne "Y"
Then: pushkey "[BRKY][BRKY]x"
4 ------- - - - - - - - - - - -
If:
Then: end
5 ------- - - - - - - - - - - -
@entsel If: @cd eq ""
Then: pushkey "x"
6 ------- - - - - - - - - - - -
If:
Then: end
7 ------- - - - - - - - - - - -
@menu If:
Then: dim myiua(3)
8 ------- - - - - - - - - - - -
If:
Then: myiua["1"]="Choose Record Operation"
9 ------- - - - - - - - - - - -
If:
Then: myiua["2"]="A:Add a New Name"
10 ------- - - - - - - - - - - -
If:
Then: myiua["3"]="S:Search for a Name"
11 ------- - - - - - - - - - - -
rptmnu If:
Then: cls("22")
12 ------- - - - - - - - - - - -
If:
Then: menu myiua doadd, dosrch
13 ------- - - - - - - - - - - -
If:
Then: exit
14 ------- - - - - - - - - - - -
doadd If:
Then: pushkey "3"; end
15 ------- - - - - - - - - - - -
dosrch If:
Then: pushkey "4A"; end
The code above assumes that index A as referenced on line
15 (after the "4"), is built on the field that is to be
searched with the "S" user menu option.
This program still works if you don't include the @entsel
section near the top. It is just my preference that
as long as you are restricting the user to only search or
add a new record, then also don't leave them in "Enter
Selection" mode on an unsaved record. The @entsel section
just returns the user to the custom menu whenever they bail
out of a prompt that leaves them on an unsaved record. (So you
would not want to use this, for instance, if you were still
allowing the user to go into the file by Record Number,
because then, just using up/down arrow would throw
you out to the menu if you came across an unsaved record.)
The program should also still work without the first four
lines (that get executed when the record is saved). This
code just makes it clearer to the user that the record
they just entered is saved and gives them a clearer
interface for deciding what they want to do next--add
another or quit. (Rather than just always presenting
a new record and requiring the user to cancel
to quit out of continous add mode.)
I think for line 3 on Windows, you probably only need
one "[BRKY]".
You can certainly get fancier than this in terms of
popups, etc. to capture the data, but just be careful
to test different scenarios of add-records and
canceling out when you start taking over the default
behavior of filepro this way.
Bruce
Bruce Easton, STN, Inc.
More information about the Filepro-list
mailing list