To order Alpha Four or Alpha Five, click above to go directly to Alpha, or call 800.451.1018 or 781.229.4500

             
HOME
TOPICS
News & Notes
Learn Alpha Five
Tips & Tricks
Tech Corner
Developer Spotlight
CONTENTS
Welcome
Alpha Five Developer's Conference
Alpha Five to the Rescue
Building an Application
Interview with Steve Workings
Quick "Find" button.
Alpha Four to Alpha Five transition
"Hot" keys for non-mouse users
AlphaHolic Anonymous
About the Editors...
Quick "Find" button.
by Bill Warner

Here is a quick and intuitive way for a user to find a record, based on an existing index. Instead of having the user click on the Index button in the toolbar, and then click on Find by Key, I designed a button to do both operations. Then, to make it intuitive, I put the button where the field's label would normally be, and made the label on the button the name of the field. For example, the button for the JOB field is called JOB.

The following is a simple script to find the Job number (index name is "job"):

dim global jobno as c
parentform.index_set("job")
parentform.find()


This will pop up the Find by Key box, so the user can enter the job number. However, that box has it's own text, and can appear almost anywhere on the screen. Here's a script that lets the developer decide what text to display:

dim global jobno as c
parentform.index_set("job")
jobno = ui_get_text( "JOB NUMBER", "Enter Job Number", jobno)
IF jobno = ""
   END
END IF
parentform.find(jobno)


This has several advantages. First, I can control the text in the message box, and the box always appears in the middle of the screen. It is also nice because the user never sees the actual name of the index, which can sometimes be cryptic. Either script makes the app more intuitive for the user since he can click on the label for the field he wants to find.

Note that the message box will display the previous value (which is handy when doing repetitive finds) because the jobno variable is defined as Global. Also, if the user clicks on CANCEL, the script halts (so the user doesn't lose the record being viewed), but the index is reset to the one called by the button. This can also be handy if you want to find a certain job, but then want to look at the next few records in a different sort order (by clicking on the CUSTOMER button, for example).

The second script can also be expanded to put conditions in the script, or pad the left of a character field that uses numbers.

Editor's note:  Do you have a tip or trick that makes your programming easier?  If so, please send it to Tips & Tricks (http://www.alphasoftware.com/tips/default.asp).
[PRINTER FRIENDLY VERSION]

LETTERS

There are no letters for this article. To post your own letter, click Post Letter.

[POST LETTER]
Powered by iMakeNews.com