[wxPython] Position of a pop up menu

I noticed that Robin, ie it doesn't let it go below the bottom of
the actually screen, however it would look much neater, given the
knowlege of the programmer (me!!!! - hey I'm learning little by
little - very slow though!!), that because of the number of items on
the menu, it will visually be more in line with the users eyes if
popped up higher on the screen. So I wanted to be able to know the
exact xy cursor point and have the bottom of the menu not go past
that. Any solution?

Not that I know of.

I just created something of a hack that will do this...

My list class saves the x,y of the right click by catching EVT_RIGHT_DOWN

It creates a context sensitive menu in the event handler for EVT_LIST_ITEM_RIGHT_CLICK

It then subtracts "N" pixels per item on the menu from the "y" position and
displays the popup there. My hack uses 18 pixels per item, but that would
change with different fonts, so there's still some font metrics code to write.

Speaking of which, is there a built-in way to ask for the size (in pixels) of
a string in a given font?

Garry

···

-------------------------------------
Garry Simmons
simmonsg@symbol.com

Gary, when you've done your code could you post a copy to the list?

Thanks in hope!

···

On Friday 09 August 2002 7:15 am, you wrote:

>> I noticed that Robin, ie it doesn't let it go below the bottom of
>> the actually screen, however it would look much neater, given the
>> knowlege of the programmer (me!!!! - hey I'm learning little by
>> little - very slow though!!), that because of the number of items on
>> the menu, it will visually be more in line with the users eyes if
>> popped up higher on the screen. So I wanted to be able to know the
>> exact xy cursor point and have the bottom of the menu not go past
>> that. Any solution?
>
>Not that I know of.

I just created something of a hack that will do this...

My list class saves the x,y of the right click by catching EVT_RIGHT_DOWN

It creates a context sensitive menu in the event handler for
EVT_LIST_ITEM_RIGHT_CLICK

It then subtracts "N" pixels per item on the menu from the "y" position and
displays the popup there. My hack uses 18 pixels per item, but that would
change with different fonts, so there's still some font metrics code to
write.

Speaking of which, is there a built-in way to ask for the size (in pixels)
of a string in a given font?

Garry

-------------------------------------
Garry Simmons
simmonsg@symbol.com

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

Speaking of which, is there a built-in way to ask for the
size (in pixels) of a string in a given font?

    dc = wxClientDC(window)
    w, h, d, el = dc.GetTextFullExtent(font)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!