How to set the font size and line spacing of menu items?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to set the font size and line spacing of menu items?
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to set the font size and line spacing of menu items?
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
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?
How exactly would I do that? It is not very clear from your post. Will a piece of code likedunbarx wrote:...... You can certainly set all text properties in the actual menuItem that is finally displayed. ......
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).
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.Is it that you want to display more lines within a given vertical area?
Regards,
Sri.
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to set the font size and line spacing of menu items?
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
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?
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.
Regards,
Sri.
-
- Livecode Opensource Backer
- Posts: 73
- Joined: Sun Jun 17, 2007 12:08 am
- Location: Montréal, Canada
Re: How to set the font size and line spacing of menu items?
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!
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!
Michel
Montréal, Canada
Montréal, Canada
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to set the font size and line spacing of menu items?
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
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
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to set the font size and line spacing of menu items?
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:
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
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
Craig
-
- Livecode Opensource Backer
- Posts: 73
- Joined: Sun Jun 17, 2007 12:08 am
- Location: Montréal, Canada
Re: How to set the font size and line spacing of menu items?
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.
Would you care to comment on my latest post (regarding system fonts)?
viewtopic.php?f=7&t=34715
Regards.
Michel
Montréal, Canada
Montréal, Canada
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: How to set the font size and line spacing of menu items?
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.
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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn