Re: ATTN Derek: EuGrid Sort Menu and win32lib
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 16, 2004
- 502 views
Phil Russell wrote: > > Hi Derek, > > You may recall some posts a few days ago about the sort popup menu > behaving strangely in EuGrid with win32lib 0.6.x. > > I finally had a chance to have a look at this and found that the sort menu > placement was indeed working differently in 0.59 and 0.6.x of win32lib. > > The difference is down to a change in the popup() procedure, specifically > the way that the code determines the parent window for the menu. This > drives the coordinate transformation used to place the menu on the screen. > > The difference: > > 0.59.x : parent = window_owner[ id ] > 0.60.x : parent = findParentWindow(lPopupId) > > The findParentWindow function travels up the tree until it finds a > top-level window class. Unfortunately this means that it does not return > the id of the grid window as this is actually an owner-drawn button control. > The menu placement is therefore calculated on the basis of the window > containing the grid control, which accounts for the strange results. > > I ended up creating the grid as a button control because when I started > developing it I didn't seem to be able to create a vanilla child window > to draw the grid contents on. I guess I always knew this would come back > to haunt me in the end! > > Anyway, unless you have any clever ideas, the easiest fix is probably for > me to clone the old version of the popup() procedure and use that instead > of the base win32lib version. > > What do you think? 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