[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Margins and aligned components

Posted on 1997-12-12
5
Medium Priority
?
347 Views
Last Modified: 2010-04-04
Hi,

Is it possible to set the margin which Delphi 3 uses when it aligns components? If I align a component with, for example, alClient. Can I specify how much space (pixels)(instead of the default 2 pixels) I will have between the parent edge and my components edge?

/pivar
0
Comment
Question by:pivar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1353433
I think that the 2 pixel edge is determined from the system metrics.  There is a way to get around this problem.  Put a panel on your form, and set BevelInner = bvNone, BevelOuter = bvNone, and Align = alClient.  Set the panel's BorderWidth to the value you require and put your control inside the panel.

Regards,
JB
0
 
LVL 22

Author Comment

by:pivar
ID: 1353434
Hi JimBob,

Your solution works, but I'm reopening the question because I would like another solution. I don't want to use panels because I have problems with scarce windows resources. And if I recall right, the panels uses windows resources.

Thanks,
pivar


0
 
LVL 4

Expert Comment

by:StevenB
ID: 1353435
 You could always set the width and height of your component yourself using OnResize.

  e.g.

  {For a border of 10 pixels arround your component, place the component such that Top and Left := 10}
  In the OnResize Put something like:
 
  *Component*.Width := ClientWidth-20;
  *Component*.Height := ClientHeight-20;

  Steven.

  {Just a comment for the moment, but if you like the answer then let me know}

0
 
LVL 4

Accepted Solution

by:
d003303 earned 200 total points
ID: 1353436
Hi,
I think there is no solution except the modification of the anchestor object TControl.
If you do so, you need Delphi Professional or C/S to modify the source.

I don't want to go too much in detail here, but the strategy is the following :

Best would be to set a global value for the indent, not one value for each corner. This has to be a new published property for TControl. In the property write handler, you have to call RequestAlign if the property was really changed.

The core modification is the protected method AlignControls of TWinControl (unit Controls). In the internal procedure DoPosition you modify the SetBounds-Values accordingly, incrementing or decrementing the bounds by the indent property value.

Hope this helps,
Slash/d003303
0
 
LVL 22

Author Comment

by:pivar
ID: 1353437
Hi d003303,

I've had the same thoughts. I just hoped there would be an easier way to do this, like a property to set somewhere, but I suppose this is the way to do it.

/pivar
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question