9

I was looking for a way to standardize my applications layout to boost my productivity since I am wasting too much time positioning visual elements on every form and dialog. I started looking around and found on MSDN

Since Delphi VCL Designer use Pixels and all component Height and width are in pixels. I like to know if there is an easy way to apply those recommendations. or there is a Delphi equivalent

For exp: in the recommendations the edit boxs and the buttons should be the same height, but the default height in Delphi are 21 for the TEdit and 25 TButton. Changing this every time you drop a button is ridiculous.

Najem
  • 537
  • 4
  • 12
  • 1
    +1. I don't see why this isn't a "real question". – Andreas Rejbrand Apr 20 '11 at 23:58
  • 2
    What part of the link are you looking to implement? The conversion from pixels to DLUs? The link explains that. The recommended size in height? Windows does that. The spacing between controls? That has to be done at runtime if you want to adapt to DLU on a system-specific basis, or you can use Delphi's built in scaling. All of them? It's not clear to me what the question is asking - that's a long document. It's impossible to answer as asked, IMO. RRUZ's attempt resulted in 9 links and no answer not in the question's link (no offense to RRUZ intended) - impossible to answer here as asked. – Ken White Apr 21 '11 at 00:10
  • 2
    @Ken, the question is not very specific, but to me the key to understand the question is `..I am wasting too much time positioning visual elements on every form and dialog...I like to know if there is an easy way to apply those recommendations?`, ok the response for that use the gexperts or Cnpack wizards to facilitate the process, and read the updated MSDN documentation about the visual guidelines to follow. – RRUZ Apr 21 '11 at 00:18
  • I agree with Ken (with no voting yet), there's no question. @Najem - do you want to setup grid size in designer or explain how margins work ? Or you want to know something about DLU ? –  Apr 21 '11 at 00:21
  • 1
    @RRUZ: I respectfully disagree. This is entirely too vague-to me it's no more complete than "How can I design a modern user interface in Delphi?". It's so impossible to answer that you had to post no less than 9 articles, 7 of which basically said the same as the OP's link. You might as well say "space them according to the measurements in the link says". GExperts and CNWizards might make things a little easier, but so does multi-selecting controls and moving them using the arrow keys in the IDE. How do any of those implement the entire linked article guidelines? If they don't, which parts? – Ken White Apr 21 '11 at 00:23
  • Also please note I did *not* downvote the question, as I was hoping the OP would rephrase to something more answerable. However, I can't upvote it as is, either. – Ken White Apr 21 '11 at 00:25
  • @Ken, I don't have any problem with your opinion, i think, which i see the question from a different point of view which you. – RRUZ Apr 21 '11 at 00:33
  • @RRUZ: I know. It's OK to disagree from time to time. :) – Ken White Apr 21 '11 at 00:44
  • For the `I am wasting too much time positioning visual elements` I would suggest OP to set designer grid size and keep "Snap to grid" enabled and for the sizing don't know (I'm not sure mentioned IDE experts can affect sizing or alignment at component addition) –  Apr 21 '11 at 00:48
  • 2
    This isn't a real question and there's no answer to it anyway. Somebody has to position the UI elements. That person is the designer. There are no shortcuts. – David Heffernan Apr 21 '11 at 06:42
  • -1; 5 upvotes is too much for abstract question like this. I've asked even very specific questions, but have max 4 upvotes for them. Moreover I can't feel this may be useful for anyone in the future. Anyway +1 for RRUZ for the mentioned IDE experts :) –  Apr 21 '11 at 08:42
  • @ken, @Daivd there is an answer for this, "use IDE experts" and I didn't know about that. thinks – Najem Apr 21 '11 at 11:12
  • @ deamon I will edit my question to be useful for any one like me. – Najem Apr 21 '11 at 11:13

3 Answers3

11

Since you are using delphi which only target the windows systems (for the moment) you must follow the Microsoft guidelines, so try checking the Windows User Experience Interaction Guidelines site which is an updated version of the link which you posted.

check these related links to the Windows visual guidelines

and this from the embarcadero site

Additionally you can use plugins like GExperts or CnWizards to set the visual properties of multiple controls at once like (Width, Heights ,tab orders and others).

RRUZ
  • 134,889
  • 20
  • 356
  • 483
2

This may not be the answer you're looking for; but approaching your question from the "I am wasting too much time..." angle you might be interested to look at the Developer Express Layout Control (http://www.devexpress.com/Products/VCL/ExLayoutControl/).

The nice thing about this component is that the layout specs can be held centrally in a "layout repository", so you can adjust spacing and look and feel for all forms on your control in one place.

It also does a pretty good job of importing existing forms and their controls so conversion isn't a major pain. They do say the layout control works best with developer express editors (which I use) so I cannot make any comment on any specific issues with "standard" VCL controls.

(Disclaimer: just a satisfied customer, no affiliation)

Stuart
  • 393
  • 2
  • 9
  • I will first try Open Source solutions if I get no satisfaction, maybe I will try ExLayoutControl !!! – Najem Apr 21 '11 at 12:01
0

Use Frames

You can improve the consistancy of your application by using frames.

If you have a screen or panel with controls that you use in more then one place, you can use one frame to drive all of them. The frame will look identical everywhere, because there's only one source.

You will only have to position your components once, saving time.
And if you put as much code as possible in the frame you'll also save time writing code.
Frames are best used in a newer Delphi version, as the implementation of Frames on older Delpi's is not 100% bug free.

On Delphi 2007 (which I use) they work great though.

See: What is the accepted way to use frames in Delphi?

Community
  • 1
  • 1
Johan
  • 74,508
  • 24
  • 191
  • 319