There are a few things that every single one of our internal programs should do:
- Every dialog should be sizeable if it makes any sense at all. Delphi makes that easy with the Align and Anchor properties. Ask yourself the following questions. If you answer any of them with Yes, you should make the dialog sizeable:
- Is there a list with an unkown number of entries?
- Is there a text entry field which can contain very long text (e.g. a file name)?
- If a dialog is sizeable, set a minimum window size that allows all controls to be visible in a reasonable size.
- If a dialog is sizeable, you should test it after every change. It is embarrassing if one button does not move the way it should.
- If a dialog is sizeable, it should store its position and size and load it when it is being opened again. But keep in mind, that the screen sizes and arrangements can vary from one computer to another and can even change on the same computer because somebody rearranged the physical positions of his monitors or got a new one.
- Do not store the position and size centrally for all users. If you do that, some of them will hate you. I prefer HKCU in the registry for that.
- Always make sure that the dialog is fully visible on a monitor. A dialog that opens outside the visible area is an embarrasment and also a support nightmare.
- Make it easy for the user to find version information. I prefer having it right in the main window’s title. e.g. “My Super Application [22.214.171.1242 2019-04-03]”. The date here comes from the project version which our build scripts automatically fill with the build date.
There are a few functions in the unit u_dzVclUtils of my dzlib that make this a lot easier. They are usually called in the form’s constructor:
- TControl_SetMinConstraints sets the Contstraints.MinWidht and .MinHeight properties to the current (designed) values
- TForm_AppendVersion appends file and project version to a form’s caption. Of course this should be called after any translation of the caption.
- TForm_ReadPlacement (and in the destructor TForm_StorePlacement)