Maintain Presets and Defaults
By Mark Derwin
Two issues popped up last month, and I would like to share them and their solutions with all of you. The techniques used in these solutions will assist you in developing applications.
Default Button
After allowing the user to make selections and add data into a form, a client wanted to be able to press Enter to process the information. He didn’t want his user to have to tab to, or click the Process button.
This is an easy one. When you look at the properties of a button, one of the items is DefaultButton. It can be set to Yes or No. If it is set to Yes, when the user presses Enter at runtime, the click trigger fires. Problem solved.
One word of caution, though: Do not try to set this property for more than one button on your form.
Presetting Radio Button, List Box, and Combo Box
This is a topic that has come up before, but I don’t think I have fully addressed it. When you create any of these three objects, the items can come from either a stack, or be hard-coded directly into the object.
If the items come from a stack, then presetting them to a value is easy. Use the following:
Winform Show_Inactive form;
-* form is the name of the form.
Compute Stk.focindex = n;
-* Stk is the name of the stack popu-
lating the object
-* n is the row number that is preset.
Winform Show form
However, if the values have been hard-coded use this instead:
Compute Form.Object.ListItems.FocIndex = n;
-* where Form is the name of the form
-* Object is the name of the object
-* n is the row number that is preset
Neither of these techniques will work for a multi-select list box. That is a topic for another article. Stay tuned.

|