Jump to content
FreeDelphiPascal

I need a foldable/collapsible panel

Recommended Posts

Hi. I used to use in my program this great component called TFoldPanel. It was for Delphi 1 to Delphi 3 but still works today. (Isn't great when a great programmer makes a control so great that it still works today under Delphi 11?)

When you click the chevron (first image, left side), the whole panel, with everything inside collapses (image 2).


However, it has a big problem: it does not support skins (VCL styles). (image 3 - the panel should be black)

Does anyone know a similar component?

 

image.png.a0167fa0d043e5c925ab98269cf78bef.png

image.png.1a65c0508927adc4126ef5a2b0a9cdfd.png

image.thumb.png.0c2d5c1a5e72665c7477b3a677032a1a.png

 

Share this post


Link to post
1 hour ago, FreeDelphiPascal said:

However, it has a big problem: it does not support skins (VCL styles). (image 3 - the panel should be black)

Does anyone know a similar component?

Do you have the source code for TFoldPanel? If so, why not simply update it to support Styles?

  • Like 1

Share this post


Link to post
4 minutes ago, Remy Lebeau said:

Do you have the source code for TFoldPanel? If so, why not simply update it to support Styles?

I am just lazy. Replacing the control with an existing control will take way less time.

As I said, the code has lines of code specific for Delphi 1/2/3 (conditionals).

Anyway, I am in the source code now, chin-deep 🙂

Share this post


Link to post

A little too late, but TSplitView shipped with D11 can also do this, with an addition of animated opening / closing. The backdraw is it only can be opened to the side, so you cannot expand down as far as I checked.

I'm using it as a collapsible menu, opening by hovering your mouse on the chevron:

 

image.png.cbbb76768d4263f4529851b06b1c49c5.png

Share this post


Link to post

CategoryPanel or Tabsheets in pagecontrol with tabs left side.  Or try the samples in /Samples for ideas.  Ray K site https://delphibydesign.com/ has a few samples under downloads. I look at his generics samples from time to refresh how generics and even how to set earlier object list code.      

Share this post


Link to post

Problem with this kind of panels is that the space where icon is placed (in "collapsed/closed" mode) is taken for other components. 

 

Share this post


Link to post
On 10/5/2023 at 5:08 PM, limelect said:

@FreeDelphiPascal

can you put here the fixed source?

The fix is not perfect. still needs improvements. but it works for the moment.

Plus, a similar change needs to be done to change the separator line (divider).

 

 

procedure TPaneles.Paint;
var
   Rect: TRect;
   FontHeight: Integer;
const
   Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
begin
  if StyleServices(Self).Enabled                                         //mine
  then Color:= TStyleManager.ActiveStyle.GetSystemColor(clBtnFace);      //mine

 

Share this post


Link to post

Thanks, I will wait for the final fix

Thanks for the source

Edited by limelect

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×