Re: start buttons?

On Thursday, October 23, 2003, at 12:40 AM, Glen Gibson wrote:

Yeah, doesn't positioning go by top-left on a popup menu though? So it'd
have to be forced to display in a specific position on the screen.

right. the difference is you'll have to ask the popup how big it is, and adjust the location by that, like

     x = left of button
     y = top of button - height of menu

but one snag you will hit is trying to get the size of the menu before it's been shown --- that requires $widget->get_child_requisition, which is bound in CVS but not in 1.00. (discovered that while writing the menu position function for the CellRendererPopup.) there may be other workarounds, though, including actually realizing the menu in the position function, etc. (i haven't tried specifically what you're asking for, but i've done stuff like it.)

Would some sort of function have to be written that would make the popup menu aware of the size and the position of the toplevel window and alter
its own size and positioning based on how many options it contained

the menu doesn't care where the toplevel is. $menu->popup () allows you to supply a function which returns the coordinates of where the menu's upper left corner should be when it gets shown. the menu will figure out on its own how big it needs to be, like pretty much every other widget in Gtk. the complication here is that we need to know that size *before* it has been calculated; so you have to get the menu to calculate its desired size and return that.

muppet <scott at asofyet dot org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]