Jump to content
Chris1701

Ways to change the text size in a Popup menu?

Recommended Posts

I have an application that has two versions both VCL, one for the desktop and one written specifically for a Windows Tablet to be used with the touchscreen. Back when I was first working on the tablet version I was looking for a way to change the text size of Popup menus, mainly because on the tablet when using touch the default text size for popup menus is way to small to be able to select an item by touch people with the group where I was asking the question said "Here, use Alpha Skins because these components let you do that" so I did buy it and it's had been working fine. However no one has heard from the developer in two years and it's been mentioned he is the Ukraine and people in the forums are speculating that he's possibly been killed and that there will not be updates that are needed to get the software to work on Delphi 13.

 

So what are other options, possibly for components that are Delphi 13 compatible that would allow you to set the font size in a popup menu?

Share this post


Link to post
24 minutes ago, Remy Lebeau said:

Have you tried changing the Size property of the VCL's global TScreen.MenuFont?

When I asked this question the first time 5 or 6 years ago I got a few responses but that wasn't one of them. I'll test that and get back to you. Thanks Remy!

Edited by Chris1701

Share this post


Link to post
20 hours ago, Remy Lebeau said:

Have you tried changing the Size property of the VCL's global TScreen.MenuFont?

Now while your suggestion works fine and sets the font size there is a problem where the width of the popup menu is too small and some lines run longer than the width of the popup menu and the text of some lines is getting cut off. Is there a way to make the width of the popup menu wider so that the complete text is visible?

Share this post


Link to post
1 hour ago, Chris1701 said:

Now while your suggestion works fine and sets the font size there is a problem where the width of the popup menu is too small and some lines run longer than the width of the popup menu and the text of some lines is getting cut off. Is there a way to make the width of the popup menu wider so that the complete text is visible?

Sorry, it took some Googling but I worked out how to fix the Popup menu width problem but I got it. Thanks

Share this post


Link to post

If you want more control, I really recommend going with owner-draw / custom-draw menus instead of relying on workarounds like Screen.MenuFont. With TMainMenu you can enable OwnerDraw and then handle the OnDrawItem and OnMeasureItem events. That way you can set your own font size, text alignment, and also calculate the correct item width so that no text gets cut off.

This approach avoids the side effects you’re seeing and gives you full flexibility to style your menus exactly how you want.

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

×