Jump to content


Photo

NxPanel6 Margin/Padding doesn't function that same as NxPanel InnerMargin


  • Please log in to reply
4 replies to this topic

#1 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 24 January 2018 - 06:58 PM

In the past, using NxPanel then setting an InnerMargin (ex. 20,10,10,25) and then aligning a nested control to client, the nested control would fill the panel to the bounds set by the panel's margin.

 

See image. NxPanel

 

https://i.imgur.com/rKgQcOe.png

 

Using the NxPanel6, it doesn't function the same way, which makes it difficult to use instead of NxPanel since I've used InnerMargin a lot.  I'd like to use NxPanel6, since it supports alpha channel and NxPanel doesn't.

 

See image. NxPanel6

 

https://i.imgur.com/9JHWxEK.png

 

Is there some way to make NxPanel6 function the same way? I've tried adjusting Margin and Padding and neither work the same way.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 January 2018 - 08:11 PM

Hi,

If you have newer (relatively speaking) version of Delphi. You can just set AlignWithMargings to True.

Version 5 was pre-Padding era component so I didn't include InnerPadding property in new release.

But if you don't see AlignWithMargins property I can add it to the old Delphi releases too (and use IFDEF compiler checking).

Hope it helps.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 02 February 2018 - 10:36 PM

Hi,

If you have newer (relatively speaking) version of Delphi. You can just set AlignWithMargings to True.

Version 5 was pre-Padding era component so I didn't include InnerPadding property in new release.

But if you don't see AlignWithMargins property I can add it to the old Delphi releases too (and use IFDEF compiler checking).

Hope it helps.

I have no option to AlignWithMargins in D7. I don't think it was added until D2009.

 

http://docs.embarcad...ithMargins.html

 

If you can add it with IFDEF that would be awesome.

 

Thanks!



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 03 February 2018 - 03:10 PM

Hi,

Can you please tell me does adding this method in protected section of TNxPanel helps:

You will need to re-compile to use in design-time. If you want, I can move this method upper in hierarchy and have it for all controls.

    procedure AdjustClientRect(var Rect: TRect); override;
...
procedure TNxPanel6.AdjustClientRect(var Rect: TRect);
begin
  inherited;
{$IFNDEF PADDING}
  Inc(Rect.Top, Padding.Top);
  Inc(Rect.Left, Padding.Left);
  Dec(Rect.Bottom, Padding.Bottom);
  Dec(Rect.Right, Padding.Right);
{$ENDIF}
end;

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 04 February 2018 - 05:18 AM

Hi,

Can you please tell me does adding this method in protected section of TNxPanel helps:

You will need to re-compile to use in design-time. If you want, I can move this method upper in hierarchy and have it for all controls.
 

    procedure AdjustClientRect(var Rect: TRect); override;
...
procedure TNxPanel6.AdjustClientRect(var Rect: TRect);
begin
  inherited;
{$IFNDEF PADDING}
  Inc(Rect.Top, Padding.Top);
  Inc(Rect.Left, Padding.Left);
  Dec(Rect.Bottom, Padding.Bottom);
  Dec(Rect.Right, Padding.Right);
{$ENDIF}
end;

This works using padding. Thank you.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users