IntroductionOne common user frustration is dialog boxes that cannot be resized. Although there are many approaches to solve this problem, most are oriented towards new code that can be designed around resizing. This leaves an existing body of dialogs that can never be resized. This article describes an approach that allows resizing to be easily retrofitted to Win32 dialog boxes. By dialog boxes, note that this specifically refers to dialog boxes defined in resource scripts that are instantiated with the DialogBox() (or similar) Win32 function. BackgroundTraditional Win32 dialogs are defined in resource scripts that define the existence and placement of controls within the dialog. A typical approach to implementing resizing, however, involves writing code to alter the placement defined by the resource script. Following contemporary programming practice, this article instead suggests using the resource script to define resize conventions, leaving the code itself minimally altered. The main goal is minimal change to existing code, making a retrofit as simple as possible. Resizing can create many pitfalls for developers and designers. Dialogs must be tested not just to work well in a preconfigured size, but in every potential size. To minimize the test requirement, the approach suggested by this article involves designing a dialog in its minimal size, creating the dialog at this minimal size, but the user retains the option to enlarge the dialog. New space created by this resize operation is then credited to controls following markup in the resource template. In addition, constraints can be optionally imposed on the resize operation. This may prevent a dialog being limitlessly expanded, or could prevent a dialog being resized in a particular orientation (for example, the dialog can be resized vertically but not horizontally.) Read more: Codeproject
0 comments:
Post a Comment