Weird PopupMenu drawing

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?

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

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?

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

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.

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

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.

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()!

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 ;).

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