Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TN9010.ZIP
Filename : OVRD-MCH.TXT

 
Output of file : OVRD-MCH.TXT contained in archive : TN9010.ZIP
This article is reprinted from the October 1990 edition of
TechNotes/dBASE IV. Due to the limitations of this media, certain
graphic elements such as screen shots, illustrations and some tables
have been omitted. Where possible, reference to such items has been
deleted. As a result, continuity may be compromised.

TechNotes is a monthly publication from the Ashton-Tate Software
Support Center. For subscription information, call 800-545-9364.

Overriding Multiple Choice
Gilbert Catipon

Have you ever thought it might be nice to be able to select a field
value from a list and yet be able to enter any value into that field?

This article reveals the not-too-obvious method for creating a
multiple choice field in a format file which allows you to be able to
select a field value from a list or enter your own value. It will
require you to edit the format file, so remember that modifying the
screen format will overwrite the .fmt file.

A format file is compiled simply by issuing SET FORMAT TO filename> from the dot prompt. If you are working from the Control
Center, the file will be recompiled automatically. However, it is
possible that if the format file is already selected, the version of
the format file in memory will be the version used, giving the
appearance that changes you made manually to the code file did not
recompile. Therefore, always close the format file before modifying
it.

Now, on to our format file. Modify or create a screen format and
select the particular field that you want to have a multiple choice
list. Press F5 to select a field then select Picture functions:
Multiple choice and enter the items. For example, if the multiple
choice field was CITY, you could enter the choices: Los Angeles, San
Francisco, Palm Springs, and press Enter.

Note that there is an extra comma followed by a blank space at the end
of the list of choices. This is needed for the second step. If you
have never used this option before, this function gives you four

choices for the field (including blank) activated by pressing the
spacebar. Not quite obvious or documented is that the user can press
the first letter of the item. For example, pressing S would display
San Francisco as the selection.

Our next step is to get the city that's not on the list. In our
example, we simple press F8 to copy the field city immediately to the
right. This gives us a duplicate of the city field. Press F5 then
choose Edit options: Permit edit if. We then enter an expression to
check whether the field is blank; in our example: len(trim(city)) =
0. Looking at the resulting format file we get:

@ 5,12 GET City PICTURE "@M Los Angeles,San Francisco,Palm Springs,
"
@ 5,40 GET City PICTURE "XXXXXXXXXXXXXXX" WHEN len(trim(City)) = 0

All that's left to do is to add the existing value to the list then
change the column position of the second @.GET to the same position as
the first @.GET.

@ 5,12 GET City PICTURE "@M Los Angeles,San Francisco, Palm Springs,
," + City
@ 5,12 GET City PICTURE "XXXXXXXXXXXXXXX" WHEN len(trim(City))=0

and voila!, multiple choices to your heart's content.

Once compiled and executed, the user can simply go the field and:

1. Press the first letter of their choice

2. Press the space bar and see all the choices

3. Press Enter once and then type in any city

Naturally you can combine this with other options. For example, using
the Edit options: Accept value when prompt on the second @.GET
statement and entering the expression len(trim(City)) > 0 would ensure
that the user types in a value for city.

Keep one last point in mind. Anytime you edit the code files of a
screen form, label, report or applicacation generator, the
modification can be overwritten by changes to the work surface files.
So it is a good idea to rename your code file if you want it to remain
intact.


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TN9010.ZIP
Filename : OVRD-MCH.TXT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/