Tuesday, April 7, 2015

Dexterity - multi-purpose button for a window that is both an Inquiry and Lookup

The window has two modes:
Inquiry - button should say OK, and simply close the form
Lookup - button should say Select, and return the selected record

There's two ways to do this:
Multiple buttons - swap / hide the button based on what mode is being used.

1 Multi-purpose button - Add two images to the button, and use Field_SetImage(), Field_SetCaption(), and Field_SetBooleanProperty(field, FIELD_PROP_DEFAULT, bool) depending on the mode. In the change script use Field_GetImage() to retrieve the image index - which tells you the mode.

I've done this both ways, and I prefer the multi-purpose button. The more modes that are needed, the better the multi-purpose button solution becomes - because you have fewer fields to juggle around.

No comments:

Post a Comment

There was an error in this gadget