Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Recent Locations' button in 'modern' OpenDialog shows no text #210

Open
tfrost opened this issue Jul 10, 2017 · 7 comments
Open

'Recent Locations' button in 'modern' OpenDialog shows no text #210

tfrost opened this issue Jul 10, 2017 · 7 comments

Comments

@tfrost
Copy link

tfrost commented Jul 10, 2017

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.

@RRUZ
Copy link
Owner

RRUZ commented Jul 26, 2017

Please attach a image of what you describe

@tfrost
Copy link
Author

tfrost commented Jul 26, 2017

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.
2017-07-26_18-28-28
2017-07-26_18-27-53

@tfrost
Copy link
Author

tfrost commented Sep 20, 2017

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.

@RRUZ
Copy link
Owner

RRUZ commented Sep 21, 2017

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

@tfrost
Copy link
Author

tfrost commented Sep 24, 2017

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?

@RRUZ
Copy link
Owner

RRUZ commented Sep 25, 2017

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.

@tfrost
Copy link
Author

tfrost commented Sep 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants