winapi - Child Window Z-Order -
i see in msdn, said:
if created window child window, default position @ bottom of z-order. if created window top-level window, default position @ top of z-order (but beneath topmost windows unless created window topmost). (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx)
however, documentation said: when application creates window, system puts @ top of z-order windows of same type (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632599(v=vs.85).aspx)
and tested this,
btn1 = ::createwindow(l"button", l"ok", ws_tabstop|bs_defpushbutton|ws_visible|ws_child , 10, 10, 50, 30, hwnd, (hmenu)51, hinst, null); btn2 = ::createwindow(l"button", l"cancel", ws_tabstop|ws_child|bs_pushbutton|ws_visible , 20, 20, 70, 30, hwnd, (hmenu)52, hinst, null);
the new created child window(for example: created 2 buttons in window , overlapped, can see button created later covering first button created)
is first statement in msdn contradictory testing.
the documentation accurate. being tripped problem, allow child windows draw across other child windows. painting order matters.
you fix adding ws_clipsiblings style flag createwindowex call. you'll see ok button on top. fix:
btn1 = ::createwindow(l"button", l"ok", ws_tabstop|bs_defpushbutton|ws_visible|ws_child|ws_clipsiblings, 10, 10, 50, 30, hwnd, (hmenu)51, hinst, null); // etc, use on other child windows
Comments
Post a Comment