Re: WIN32LIB : window style
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 26, 2001
- 474 views
Hi Gwen, > I've noticed a little bug (I think) about opening a window with a > specific style : > let's define > create(Window,"test",0,Default,Default,300,320,{WS_DLGFRAME,WS_SYSMENU}) > > > if later I open it with a 'modal' style, the borders of the window > disappear, and this isn't the case when I open it with a 'normal' style. > > is this a bug ? > Sort of, but in Windows not win32lib. It turns out that WS_DLGFRAME and WS_SYSMENU are mutual exclusive styles because WS_DLGFRAME is not allowed to have a title bar but WS_SYSMENU needs a title bar. So Windows alters the WS_DLGFRAME flag to WS_CAPTION when the window is created. Now, when Win32lib opens a Modal window it makes sure that the window does NOT have a minimize box. It does this by removing the WS_MINIMIZEBOX style after the window is created. It your case, there is no minimize box so the code sets the styles to exactly what they already are! But that's where Windows seems to get it wrong. This time it takes note of the WS_DLGFRAME and allows it to have a titlebar and in the process removes the border that WS_CAPTION implies. Unfortunately this doesn't explain everything 'cos when I tried to emulate Windows behaviur I get other weird things happening. Anyhow, I've "fixed" the next version so that now removeStyle() won't set the new styles if they are identical to the current style. This now means that opening Modal and opening Normal keeps the same frame effect. ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."