Re: Win32Lib: child window demo anomaly?
- Posted by Chris McConnell <chris at mc-data.com> Apr 25, 2007
- 519 views
CChris wrote: > > Dan Moyer wrote: > > > > This is not terribly important, but while looking at child windows > > in the Win32Lib demos, I noticed a behavior that looks bad: > > > > "child4.exw" makes a parent & a child window, with child just below titlebar > > of parent & filling parent; the parent has a button which is initially > > hidden > > by the child window. > > > > If, and only before you MOVE the child, you move mouse to approx. where > > button > > is under child & click, THE BUTTON IS *DRAWN* ONTO THE CHILD WINDOW! > > > > (Moving the child around so that new "button" is off the parent will "erase" > > those portions of it from the child.) > > > > This can't be good?? > > > > Here's the demo's code: > > }}} <eucode> > > -- code generated by Win32Lib IDE v0.17.0 > > include Win32Lib.ew > > without warning > > > > ---------------------------------------------------------------------------- > > ---- > > -- Window Window1 > > constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, > > 300, 0, 0 ) > > constant PushButton2 = createEx( Button, "PushButton2", Window1, 24, 28, > > 260, 104, 0, 0 ) > > --------------------------------------------------------- > > ---------------------------------------------------------------------------- > > ---- > > -- Window Window2 > > constant Window2 = createEx( Window, "Window 2", Window1, Default, Default, > > 400, 300, or_all({WS_CHILD}), 0) > > --------------------------------------------------------- > > ---------------------------------------------------------------------------- > > ---- > > procedure Window1_onOpen (integer self, integer event, sequence > > params)--params is () > > openWindow(Window2,Normal) > > end procedure > > setHandler( Window1, w32HOpen, routine_id("Window1_onOpen")) > > > > > > WinMain( Window1,Normal ) > > </eucode> {{{ > > > > Dan Moyer > > It's even worse than that. > > Windows considers the button to be visible, and Window1 gets a WM_COMMAND > message on clicking the button, even though Window2 is on top of it. > > After the definition of Window2, add the following: > }}} <eucode> > constant l2=create(ListBox,"",Window2,1,1,399,299,0) > addItem(l2,"aaaaa") > </eucode> {{{ > The non empty list displays, and clicking it brings PushButton2 in the > foreground. Child windows seem transparent, as well as their children. > Same problem with a group instead of a list or a disabled label, but not > with a button covering Window2. > > Moving Window2 using the mouse disables this behaviour. Using setRect() > or setCtlSize() right after opening Window2 doesn't. > > I looked into openWindow(), since this behaviour was making it a candidate > for the bug. Playing with the showWindow() parameter when the opened window > is a child doesn't appear to help. > > Can anyone with VC++ or similar available port this very simple code and see > if the problem persists? I don't have it at office. > > CChris I was able to get around this problem by opening the child minimized and imediately calling a showWindow(restore).