Jump to content
aehimself

VCL-styled Popupmenu issue if imagelist is assigned

Recommended Posts

Hello guys,

 

I am developing a lightweight, customized SQL client. The main form only has a PageControl, all business logic reside on a frame. When the user chooses a connection, a new tabsheet is created, and a new instance of the said frame is placed upon it. Simple, and works like a charm.

To please some people I decided to allow VLC styling of the application but this introduced a really strange issue. If the popup menu resides on the frame and has an image list assigned, it seems like that the menu is not drawn properly:

 

01-Styled_no_text.png.be97a4ab869673b43875ec74cddb2ad5.png

 

If I change the Style back to the system default (or simply unassign the imagelist component from the TPopupMenu), everything works perfectly:

 

02-Not_styled_text.png.fa6c675e798938d50a82492be3176688.png03-Styled_noicons_text.png.8ff65d0099189eb398894202d0bfa993.png

 

Menu has no owner draw set. What I tried so far:

- Add a new menu item during runtime to force a refresh of the menu

- Unassign and reassign the popup menu during runtime from the DBGrid component
- Unassign and reassign the image list during runtime

- Set all ImageIndexes to -1, even removed all menu items during design time

- Added Vcl.Styles to the uses clause of the frame

- Changing Style during runtime has no effect. If I change back to System default, popup menu start being drawn correctly

- Behavior is the same on additional modal forms, menu is not drawn correctly if image list is assigned

 

In the mean time, the popup menu on the main form works perfectly. Which is even more strange, if I assign the main forms popup menu to the DB grid during runtime, it is drawn correctly. I feel like this will be something to do with the menus not being a child of the main form, or like a special hook I'm missing (like how you are forcing styling on a SynEdit component) but I could be far from the truth.

I'm running out of ideas. Did anyone face this issue already? Any tips which I could try to make this to work?

 

Thanks all!

image.png

image.png

Share this post


Link to post

Uwe,

 

Wow, a 3 year old bug... and indeed it does look the same!

So without upgrading my Delphi installation I have no other choice than to forcefully remove icons when using Styles.

Or not to use Styles in general 🙂

 

Thank you for the quick reply!

Share this post


Link to post
9 hours ago, aehimself said:

Or not to use Styles in general

The most reliable way to avoid the legion of bugs with this feature

Edited by David Heffernan
  • Like 1

Share this post


Link to post
6 hours ago, David Heffernan said:

The most reliable way to avoid the legion of bugs with this feature

And the most reliable way to concentrate on creating the best product with a "no need to learn how to use" UI.

  • Like 1

Share this post


Link to post

Unfortunately some companies insist on having their corporate styling being reflected in their applications. Just because some colors are different from the Windows standard doesn't mean that one needs to learn how to use that UI. That is more related to uncommon handling of TAB vw. ENTER keys or the misuse of well known shortcuts.

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

×