[WIN] bug in removeStyle?

new topic     » topic index » view thread      » older message » newer message

With the following example (program listed below), I will show how
removeStyle is broken.

First, see how Win1Style is the same as Win2Style, except that it doesn't
have a minimize box.  When you start the program, click 'Open Win2 Normal'
button and compare the different styles.  Next, close 'Win2' and
click 'Open Win2 Modal'.  Notice how the frame changes.  Next, close 'Win2'
again and press 'Open Win2 Normal' again.  Notice how the frame is not the
same as it was the first time.

I noticed the removeStyle( id, WS_MINIMIZEBOX ) in 'openWindow' for Modal
windows, so lets restart the program (to reset 'Win2' style) and
click 'Open Win2 no min' button.  You might expect it to look like
Win1Style since we are only removing the WS_MINIMIZEBOX but it looks like
it did when we tried to open it as Modal.

I've stared at the removeStyle code for a while and I'm not seeing the
problem.  Anybody else care to explain this to me?

Thanks,
-- Brian

-------------------------------------------
include win32lib.ew

constant
  Win1Style = {WS_DLGFRAME,WS_SYSMENU},
  Win2Style = {WS_DLGFRAME,WS_SYSMENU,WS_MINIMIZEBOX}

constant
  Win1 = create( Window, "Win1", 0, Default, Default, 300, 200, Win1Style ),
  Win2 = create( Window, "Win2", Win1, Default, Default, 300, 200,
                                                                Win2Style ),

  Btn1 = create( PushButton, "Open Win2 Normal", Win1, 5, 5, 100, 30, 0 ),
  Btn2 = create( PushButton, "Open Win2 Modal", Win1, 5, 40, 100, 30, 0 ),
  Btn3 = create( PushButton, "Open Win2 no min", Win1, 5, 75, 100, 30, 0 )

procedure onClick_Btn1()
  openWindow( Win2, Normal )
end procedure
onClick[Btn1] = routine_id( "onClick_Btn1" )

procedure onClick_Btn2()
  openWindow( Win2, Modal )
end procedure
onClick[Btn2] = routine_id( "onClick_Btn2" )

procedure onClick_Btn3()
  removeStyle( Win2, WS_MINIMIZEBOX )
  openWindow( Win2, Normal )
end procedure
onClick[Btn3] = routine_id( "onClick_Btn3" )

-----------------------
WinMain( Win1, Normal )
-----------------------

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu