Page 1 of 1
Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 3:37 pm
by kvanbeek
The list of choices when clicking on an Option style button is the the same width as the option menu button.
Can the choices list width be automatically widened to the size of the largest string?
Thank You.
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 5:22 pm
by dunbarx
Hi.
This already is implemented in the option menu when you pull down. Do you mean that it stay at the width of that choice, so that the entire string is displayed? You could do something like:
on menuPick pItemName
switch pItemName
end switch
set the width of me to the formattedwidth of me
end menuPick
Craig Newman
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 5:39 pm
by kvanbeek
Thanks for the response.
When I pull down the menu, the list is the same width as the option button not the width of the longest choice.
I don't need the button to be the same width of the selected choice but I may consider this later.
I would just like the pull down to be the width of the longest choice. I am I missing a setting possibly?
Thanks
Keith
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 6:39 pm
by dunbarx
Bet you a Mac plus you are talking about a combo box, not an option menu, as you originally posted.
In the inspector, in the "size and position" pane, select "fit content" for "width".
This may still not be exactly what you need, but then you can always take charge on your own, using the suggestion I gave earlier, or something else entirely.
Craig
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 7:42 pm
by kvanbeek
Property Inspector says Type Option but that is beside the point.
I can't use the fit content because the choices will change based on the selection of another list.
After more searching, the option menu works the way I want on Macs and does not work in Windows.
I may have to use your suggestion to change the size of the button based on the size of the choice but I have limited real estate so I may have to find another solution.
Thank You,
Keith
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 8:01 pm
by jacque
I haven't tried it, but you could experiment with setting the button width on mouseDown and putting it back to the original width on menuPick and mouseRelease. The width of the popped open button would be the formattedwidth of its text.
Re: Option Menu width vs Choices List width
Posted: Thu Nov 07, 2013 8:58 pm
by SparkOut
It should be possible to use a stack panel as a menu if you set the menuName property. On a very quick trial (Windows 7, LC version 5.5) I can get a stack to appear as a panel but I'm not sure how to select an item on it. It's behaving as a menu showing the stack with a list field but it won't receive mouse messages when clicking, it just closes.