Page 1 of 1
How to set the font size and line spacing of menu items?
Posted: Sun Jun 24, 2012 10:01 pm
by sritcp
Is it even possible to set the text size of menu items of a pulldown menu (which is a button)?
Also, the vertical space between the menu items?
For mobile apps, the menu items need to be large enough and sufficiently separated from neighbor items to be tap-selected without error.
I couldn't find a way to manipulate the formatting of menu items.
Thanks for any light you can shed,
Sri.
Re: How to set the font size and line spacing of menu items?
Posted: Mon Jun 25, 2012 4:10 pm
by dunbarx
I believe that the font properties of the pulldown menuItems are set by the system. You can certainly set all text properties in the actual menuItem that is finally displayed. This is true for all the several button styles, like "popUp", "combo", etc.
If I am not wrong about this, you would have to roll your own pulldown, by showing a list field perhaps, and creating a mouseStillDown handler, also perhaps.
Is it that you want to display more lines within a given vertical area?
Craig Newman
Re: How to set the font size and line spacing of menu items?
Posted: Tue Jun 26, 2012 2:15 am
by sritcp
dunbarx wrote:...... You can certainly set all text properties in the actual menuItem that is finally displayed. ......
How exactly would I do that? It is not very clear from your post. Will a piece of code like
set the textSize of menuItem 1 of button "pullDownMenu" to 18
work? (the above code doesn't work; I guess because menuItem refers to the object itself not the text of its name).
Is it that you want to display more lines within a given vertical area?
No, I just want the menuItems to be more distantly spaced from each other (i.e., greater line height), so as to minimize the chances of tapping the item.
Regards,
Sri.
Re: How to set the font size and line spacing of menu items?
Posted: Tue Jun 26, 2012 3:14 am
by dunbarx
I see now what you want.
The textsize is a property of the button, not its menuItems, displayed or not. Likewise for every other text-like property. Try it either in the inspector or by script:
set the textsize of btn "yourPullDown" to 9. ( or 24)
Someone else may have an answer for you about increasing the line spacing. Is it possible for you to use a list field instead? There you can do what you want.
Craig Newman
Re: How to set the font size and line spacing of menu items?
Posted: Tue Jun 26, 2012 4:31 am
by sritcp
Unfortunately, increasing the textSize of the button (in the inspector or by script) increases only the label font size; the menuItems remain the same size.
Regards,
Sri.
Re: How to set the font size and line spacing of menu items?
Posted: Thu Sep 24, 2020 8:35 pm
by mluka
Hi all. Sorry for "reviving" such an old post.
Has this question an answer, using LC 9.6.1, community edition?
In other words, is there any way of specifying the font, font size, style of the menu Item that has been chosen in a pulldown menu?
Thanks!
Re: How to set the font size and line spacing of menu items?
Posted: Thu Sep 24, 2020 9:10 pm
by dunbarx
Mike.
Again, I am only fairly sure about the fact that the menuItems are controlled by the OS, though the label of the menuButton itself is controlled by you.
Nobody corrected me, so maybe that is in fact true.
I had suggested that it would be a snap to roll your own, in which you can control all aspects of the "menuItems" including line spacing. That also is still true. Do you need advice on how to do that?
Craig
Re: How to set the font size and line spacing of menu items?
Posted: Thu Sep 24, 2020 9:45 pm
by dunbarx
Hi.
Try this, five minutes. On a new card make a button and a listField. Turn off the vertical scrollbar in the field, and place it somewhere just below the button. Explicitly set the textHeight of the field to 13. In the button script:
Code: Select all
on mouseDown
runKludge
end mouseDown
on runKludge
show fld 1
select line the (mouseV - top of fld 1) div 13 of fld 1
if the mouse is up then
answer the selectedText
hide fld 1
exit to top
end if
send "runKludge" to me in 10
end runKludge
If you modify a few properties in each control, you can readily make this pair indistinguishable from a standard pullDown. But you can also do whatever you want to with the text properties of the field.
Craig
Re: How to set the font size and line spacing of menu items?
Posted: Sat Sep 26, 2020 4:04 pm
by mluka
Thanks Craig. That is one possible approach.
Would you care to comment on my latest post (regarding system fonts)?
viewtopic.php?f=7&t=34715
Regards.
Re: How to set the font size and line spacing of menu items?
Posted: Sat Sep 26, 2020 8:00 pm
by FourthWorld
By default, LC uses the OS-recommended font and size for pulldown menus. With something this well established, I would encourage caution creating an app that deviates from such long-standing user expectations.
That said, on Windows and Linux, pulldown menus in the menu bar can be adjusted by changing the textfont and textsize properties.
MacOS uses a global menu bar, strictly governed by the OS do such modification is far less simple, requiring digging into OS menu definition hooks via LiveCode Builder.