Re: ATTN Derek: EuGrid Sort Menu and win32lib
Phil Russell wrote:
>
> Derek Parnell wrote:
>
> > Did you read the docs for popup()? You can use it with an alternative
> > reference point.
> >
> > eg. popup({myPopupMenu, theGrid}, x, y)
> >
> > where 'x' and 'y' are relative to theGrid and not the top level window.
> >
> > How are you getting the x/y values?
> >
> > --
> > Derek Parnell
> > Melbourne, Australia
> >
> Yes - I already tried passing {popup_id, grid_id} to popup(). Although it
> improved the menu placement considerably, it seemed to be consistently out
> by approximately -10 (x-axis) and -5 (y-axis) pixels.
>
> I had a closer look just now and it seems that I only get the problem
> when the grid is placed on a tab control. With a grid on a plain window
> the placement is correct. I hadn't spotted it before because
> my main test program is style.exw which has a number of grids on a
> multi-page tab window.
>
> The x/y values I am using come from WM_RBUTTONDOWN,
> sent to the grid control.
Okay, I've found my mistake. In the win32lib routine called 'popup'
find the line ...
BBox = ScreenToClient(findParent(lRelId), BBox[1], BBox[2])
and change it to ...
BBox = ScreenToClient(parent, BBox[1], BBox[2])
Then call it using
popup({mymenu, self}, x, y)
where 'self' is the id of the control that gets the right button
event.
--
Derek Parnell
Melbourne, Australia
|
Not Categorized, Please Help
|
|