|
By William Baker Randolph's early experience with TAOS: The Developer's
Then Randolph came to talk to me. I suggested a date-verification routine, but Randolph pointed out that would only solve part of the problem (which was correct), and besides, he didn't want to write a date-verification routine in TAOS or any other language. Randolph agreed with Walt and me that a long series of prompts made for an awkward interface, and I suggested a data entry form that would allow input of all the selection criteria on one screen. Needless to say, Randolph did not want to write an input screen either, but after working with the TAOS Form Generator for a few weeks, Randolph had to admit it has advantages over writing input screens in a third-generation language. The Form Generator includes an interactive form designer, and even Randolph enjoyed learning to move fields around and especially drawing lines. In fact, I think he enjoyed drawing lines too much on the form that he showed me. The part of TAOS forms that is more interesting to me is the programming to handle different actions that can occur on each field. Doing searches on fields was Randolph's greatest concern, because he needed to present a list of customer names on the customer number fields. In a third generation language application, I would write a loop to capture and test every keystroke, looking for the search key, among others. When this loop detected a search key, it would call a search routine. In TAOS Forms this checking for certain keystrokes is done by the keyboard input routine, and all I have to do is specify the search routine to be used for that field. The search routine that Randolph had already written for Walt to look up customers by name looked like this:
In the form setup program, I told Randolph to enter the same routine in the field that defined the search for customers, with an extra statement at the end:
The last command is interpreted by the Form Generator to mean set the current form field value equal to the value in customer.cust_num. The percent sign (%) is a symbol for the current field. This equation is needed because the form program has no way of knowing that the user has just executed a search routine. It's up to the programmer to move the results of the search into the form's data structure.
"I can think of two ways to have a long search routine in a form,"
I said. "You can use the TAOS call verb, which works a lot like call
in "What help is that for me?" Randolph asked. "I don't know how to use the call command in BBx, so what does it matter if it works the same in TAOS?" "That's a great help. When you learn how to use it in one place, you'll know how to use it in the other. Look at this example:"
"This command resolves the (BBX) global string to the path where compiled TAOS programs are stored; CALLs the program cust_search.bbx; and passes the current form field as the only parameter. The cust_search.bbx has the commands to do the search, and the selected customer number is returned to the current form field." Randolph shook his head. "Passing, returning, I never understood all that. I hope your other method makes more sense." "The other way is to specify an include file with TAOS #include pre-processor command. For example:"
"This tells the Form Generator to insert an ASCII file called cust_search at the right spot in the form code. This file contains the TAOS commands for the search, and it compiles exactly like TAOS code written in the form design interface." "Well, I'll try to keep all that straight, but I guess for now I'll
concentrate on keeping my searches short so I can just type them into
the form. And I just realized that nothing makes me hungrier than
talking about forms-unless maybe it's talking about food-so it
certainly must be time for lunch."
|
|||||
| |
Copyright 1999, BASIS International Ltd. All rights reserved. Terms of Use. |
|||||