Weird PopupMenu drawing


#1

I just made a popup menu for selecting a font, so it’s got a lot of entries. The menu appears without a problem, but instead of being a single column with a down arrow at the bottom, as I would expect on the mac, it’s about three columns wide, with the first two filled, and a down arrow at the bottom of the second column. The third column appears blank.

Is this the expected behavior? Is there a way to force the menu to display in a single column on the mac?


#2

One of the params to show() is the max num columns, isn’t it?


#3

I didn’t know about the additional parameters to showAt(). Thanks for disabusing me.

After changing my code to:theResult = thePopupMenu.showAt (myButton,100,1,0);
there’s no change,however. Might this be because my font menu is actually a submenu of this menu? Is there a way to constrain the width of a submenu?


#4

Erm… maybe you meant ‘show’ rather than ‘showAt’ ?


#5

Thanks, Jules.

theResult = thePopupMenu.show(1,50,1,0);

worked like a charm. As an enhancement, it would be nice if showAt gave the same results, given the same width constraints.


#6

But it does give the same results… (??)


#7

Let me give a little more context. I’m creating a Popup menu that will be shown in response to a button click.

PopupMenu	theFontMenu;
StringArray theFontNames = Font::findAllTypefaceNames();
for (int alpha=0; alpha<theFontNames.size(); alpha++)
	theFontMenu.addItem(41 + alpha, theFontNames[alpha]);

PopupMenu     theTextMenu;
thePopupMenu.addSubMenu (T("Font"), theFontMenu);

If I use the showAt() function to show this menu, the font submenu is three columns wide.

theResult = thePopupMenu.showAt (mTextButton,100,1,0);

If I use the show() command, the font submenu is a single column

theResult = thePopupMenu.show(1,100,1,0);

I’m currently coding on the Mac side, so I don’t know if this is a platform-specific behavior.


#8

The two methods take different parameter lists, so you’re feeding it junk! That’s why I posted my original reply, because you seemed to be using the parameters for show(), but were actually calling showAt()!


#9

I just noticed on the mac (maybe it happens on pc too) that when the menu spans multiple columns and the menu has submenus, say for example in the first column… when you try to mouse over the submenu to select an item the mouse event goes to the second column instead… making it impossible to select from a submenu with another menu beneath (without using arrow keys ;).


#10

Ok, thanks, I’ll have to take a look at that.