diff --git a/source/gui/detail/native_window_interface.cpp b/source/gui/detail/native_window_interface.cpp index ed95415f..786a5df2 100644 --- a/source/gui/detail/native_window_interface.cpp +++ b/source/gui/detail/native_window_interface.cpp @@ -1235,13 +1235,14 @@ namespace nana{ native_window_type native_interface::parent_window(native_window_type child, native_window_type new_parent, bool returns_previous) { #ifdef NANA_WINDOWS - auto prev = reinterpret_cast( - ::SetParent(reinterpret_cast(child), reinterpret_cast(new_parent)) - ); + auto prev = ::SetParent(reinterpret_cast(child), reinterpret_cast(new_parent)); + + if (prev) + ::PostMessage(prev, WM_CHANGEUISTATE, UIS_INITIALIZE, NULL); ::SetWindowPos(reinterpret_cast(child), NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); - return (returns_previous ? prev : nullptr); + return reinterpret_cast(returns_previous ? prev : nullptr); #elif defined(NANA_X11) native_window_type prev = nullptr; diff --git a/source/gui/widgets/menu.cpp b/source/gui/widgets/menu.cpp index fd206764..3e1159a5 100644 --- a/source/gui/widgets/menu.cpp +++ b/source/gui/widgets/menu.cpp @@ -526,17 +526,16 @@ namespace nana auto index = state_.active; for (auto & m : menu_->items) { + if (0 == index--) + break; + if (m.flags.splitter) { pos.y += 2; continue; } - if (0 == index) - break; - pos.y += _m_item_height() + 1; - --index; } tmstamp = state_.active_timestamp;