I am working with a delphi form that appears to have a rather interesting problem. I am developing on a laptop sitting at 1920X1200 resolution. On my form, I have a trio of components. One is permanently invisible, and clicked to align/left. The next is permanently visible, and clicked to align/client. The third is permanently visible, and clicked to align/right.

At screen resolution 800x600, the align/client component vanishes when this form is opened. At 1024X768, the next size up on my box, it returns. I can think of no logical reason for this to happen, and would appreciate some suggestions as to what kind of things I should be looking into.

I am working with a delphi form that appears to have a rather interesting problem. I am developing on a laptop sitting at 1920X1200 resolution. On my form, I have a trio of components. One is permanently invisible, and clicked to align/left. The next is permanently visible, and clicked to align/client. The third is permanently visible, and clicked to align/right.

At screen resolution 800x600, the align/client component vanishes when this form is opened. At 1024X768, the next size up on my box, it returns. I can think of no logical reason for this to happen, and would appreciate some suggestions as to what kind of things I should be looking into.

For starters look at the order in which the components are being created. The alClient aligned component should be created last. As a rule this should work correctly at any screen resolution and Delphi will do its best to scale everything up/down so it fits.

Look at the .dfm by clicking Alt + F12 to see what order the three controls are being created in. You can change the order directly in the .dfm - just cut the client aligned component and paste it below the other two.

The trouble with Delphi being such a great drag-n-drop IDE is that most people play around with form design till they feel they have "got it right" at which point they promptly forget about the importance of component creation and declaration order. Generally speaking what I see in code samples I pull from the net is a right pig's dinner. There are two ways to avoid this

  1. Think out for design off-line rather than play around with drag-n-drop.
  2. Once the drag-n-drop part is done, CUT all the components, paste into notepad, and rearrange the .dfm code there so you have a more logical order. Then paste it back into your form.

The benefit with the latter approach is that you also get some semblance of logical order in your component declarations.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.