Jump to content
chkaufmann

TPopupMenu with group headers

Recommended Posts

@David Duffy I have no XE experience (went to 10.0-10.1 from 7) but you can fall back to the idea of @Lars Fosdal safely: TStyleManager is only used here to extract colors of the currently active style so the header will always "fit in" nicely.

Share this post


Link to post

I have it working nicely with fixed colours. Having it theme aware would have been nice but is not a real issue. It was more about learning.

Share this post


Link to post

I don't know what causes this, but sometimes (even within the same project) this header menu item won't show correctly - neither of the draw methods are called. By experimenting I found out that turning OwnerDraw on on the popup menu itself fixes it on those affected.

Anyone has any ideas? How come some menus work correctly without and some required OwnerDraw to call the menu items drawing methods?

 

Edit: Also, assigning an imagelist fixes this, even if no menu items are using any image whatsoever.

Edited by aehimself

Share this post


Link to post

This should explain it:

  if (ParentMenu <> nil) and (ParentMenu.OwnerDraw or (ImageList <> nil)) and
    (Assigned(FOnAdvancedDrawItem) or Assigned(FOnDrawItem)) then

 

  • Thanks 1

Share this post


Link to post
On 9/10/2021 at 12:32 AM, David Duffy said:

Is TStyleManager available in Delphi XE ?

Maybe the function ThemeServices in unit Themes is what you are looking for.

  • Like 1

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

×