Friday, April 18, 2014

Custom dialog form buttons

Sometimes I need to make a dialog form from scratch.  Of course a dialog has the OK and Cancel buttons in the lower right of the screen.  Like this:

Every time I have to do this I try about 27 combinations before I find/remember the correct control settings.  My first instinct is to use a ButtonGroup, set ArrangeMethod, and maybe AlignChild, AlignChildren, AlignControl, Width, Left, bah!  What the heck!

What works is to create a Group (not ButtonGroup), with Left = Auto(right), FrameType = None, and Columns = 2 (or however many buttons you have).  Then add your buttons into the group with all default properties.

Passing multiple parameters between forms
While I'm at it, another typical issue that comes up with custom dialog forms is how to pass multiple values between forms.  There are plenty of blog posts on the standard args.parmXYZ options, and I often think there should be a better provision for this...but in the end it seems like using con2str and str2con and args.parm is the most reasonable way to go.

Maybe this will help you save a few minutes...or help me save a few minutes next time I do it.

No comments:

Post a Comment