vcl-styles-utils
vcl-styles-utils copied to clipboard
'Recent Locations' button in 'modern' OpenDialog shows no text
With all styles except 'Windows', the pull-down menu has the correct size but no text in the menu items.
Tested in Windows 10/64, Project ThemedSysControls.
Please attach a image of what you describe
After clicking on the 'Recent Locations' button, the drop down menu with 'Use Modern Controls' enabled has the correct number of items, but no text.
Any hope of a fix for this? Or even of a hint about what could be causing the problem, that I could work on myself? I cannot consider using any of these great styles with such an obvious flaw.
Hello, My guess is which the issue is in the Popup Menu Style hook (Vcl.Styles.Utils.Menus unit), check these methods TSysPopupStyleHook.DoDrawItem, TSysPopupStyleHook.TSysPopupItem.GetItemText
Thanks, the heart of the problem appears to lie in the block of code below "fix for shell menus on W10" on line 1993 of Vcl.Styles.Utils.Menus. The returned fType is MFT_OWNERDRAW and the if-block is taken because VCLMenuItems is nil. But cch is zero and there is no text.
If I try changing "or" to "and" on line 1994 so that the else-block is taken, the returned ItemData just contains a dot and an invalid-unicode block glyph. I have seen these two characters before in some Delphi-provided styles.
It is not clear whether the comments on lines 2013-2015 mean that the code below them IS the intended 'other way' or whether 'another way' is still needed. In either case, the code below it is not executed because VclMenuItems is nil, but also is not effective.
Finally, I checked that despite the mention of W10, this is not a W10-specific issue and your code operates in the same way on W7. The version of this unit in the VCL source has a W10-specific test in this GetItemText function, but changing your source to match this makes no difference to the problem on W10. It does, however, now show the incorrect characters from ItemData on Windows 7.
Hopefully someone understands what may be going on and why this does not work! In summary, how can OwnerDraw menu text be retrieved to be rendered in the chosen style?
The code uses the GetMenuItemInfo function to retrieve the text of a menu item, unfortunately in some cases is not possible get the text for owner drawn menus , So on this case If the menu type contains the MFT_OWNERDRAW value we are out of luck. Maybe a workaround is avoid style the owner drawn menus.
In the case of this system open dialog, it is Microsoft who seem to have decided to use owner draw, in which case styling can not be used successfully.