TurboPack / MustangpeakEasyListview

TurboPack MustangpeakEasyListview is part of VirtualShellTools for the Listview but can be used for a TListview Replacement that is faster and more customizable.
Other
38 stars 22 forks source link

Provide Vcl Styles support #12

Closed esmilen closed 1 year ago

esmilen commented 3 years ago

Currently the scrollbars are not style/theme aware, so it looks rather odd when used in a theme aware application. Can such awareness be added?

pyscripter commented 3 years ago

It is not just the scrollbars. The whole control is not style-aware.

I do not have the time to invest in this, but I would be happy to consider pull requests to that effect.

esmilen commented 3 years ago

Maybe this code can be (partially) reused for the scrollbars.

VirtualTrees.StyleHooks

Dzomlija commented 3 years ago

@esmilen @pyscripter The solution is a rather elegant one, and far easier to implements than trying to adapt the code from VirtualTrees.StyleHooks.

The only issue I have with this way is that if I change the View property of a TEasyListview, or use TEasyItem.MakeVisible) to scroll to a specific item, then the scrollbars don't redraw as they should. This happens also when adapting the code from VirtualTrees.StyleHooks.

unit elv.stylehooks;

interface
implementation

uses
  EasyListView, Vcl.Themes, Vcl.Forms;

initialization
  TCustomStyleEngine.RegisterStyleHook(TEasyListview, TScrollingStyleHook);

finalization
  TCustomStyleEngine.UnRegisterStyleHook(TEasyListview, TScrollingStyleHook);
end.

EDIT: While this works well for the scrollbars, it is still necessary to implement custom item classes in TEasyListview.OnItemCustomView

pyscripter commented 3 years ago

While this works well for the scrollbars, it is still necessary to implement custom item classes in TEasyListview.OnItemCustomView

Actually all of the drawing routines need to be updated to support styles. This is quite a major undertaking made easier by the fact the control is already theme aware (DrawWithThemes property).

I have changed the title of the issue and happy to accept PRs to that effect.

Dzomlija commented 3 years ago

@pyscripter My project uses custom item classes applied in TEasyListview.OnItemCustomView. It is only recently that I've even considered the user of Themes in the application.

However, prototyping application I've created in conjunction with my main project is a utility to visually modify the various items views and colors and then to generate copy-and-paste code that I can use within my main project.

Since I've started thinking of using themes so that I might be able to adapt between Windows 10 Light/Dark modes, I've adapted my EasyListview Visual Designer. This is what it looks like so far.

ELV_Designer_Prototype_2

If I have the time to directly adapt TEasyListview to use themes, I'll have a look see what I can do, but my priorities must remain with my primary project...

NettixCode commented 1 year ago

is this support for delphi 7 ?

romankassebaum commented 1 year ago

No.

Dzomlija commented 1 year ago

I started using Delphi 11.3 a few months ago, and installed Mustangpeak Listview 2022.09 from the GetIt Package Manager.

Looks like the theming problem I've been experiencing has been resolved. I no longer need to use custom style hooks (as I mentioned way back on 2021/01/23) or anything, or even descendant classes of TEasyListview in my code.

romankassebaum commented 1 year ago

Okay, great. Then I will close the case.