From cb8917cada7180fa6c41f55b25bbf54fd63e3ae9 Mon Sep 17 00:00:00 2001 From: MurkyYT Date: Wed, 28 Aug 2024 11:17:35 +0300 Subject: [PATCH] fix(flickering): fixed flickering when using divider --- MUI/MUI.h | 2 ++ MUI/UIComponent.cpp | 2 -- MUI/Window.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MUI/MUI.h b/MUI/MUI.h index 7042915..e9a7550 100644 --- a/MUI/MUI.h +++ b/MUI/MUI.h @@ -247,6 +247,8 @@ namespace MUI { struct GridItem { friend class Grid; + public: + UIComponent* GetComponent() { return component; } private: int row; int column; diff --git a/MUI/UIComponent.cpp b/MUI/UIComponent.cpp index 0805b60..f933157 100644 --- a/MUI/UIComponent.cpp +++ b/MUI/UIComponent.cpp @@ -16,8 +16,6 @@ namespace MUI pos.x = pos.x - this->m_margin.right + this->m_margin.left; pos.y = pos.y - this->m_margin.bottom + this->m_margin.top; MoveWindow(this->handle, pos.x, pos.y, min(w,this->width), min(h,this->height), TRUE); - InvalidateRect(this->handle, NULL, FALSE); - UpdateWindow(this->handle); } void UIComponent::UpdateVerticalAligment(POINT& pos, int h,int y) { diff --git a/MUI/Window.cpp b/MUI/Window.cpp index 929f607..4b44c79 100644 --- a/MUI/Window.cpp +++ b/MUI/Window.cpp @@ -369,6 +369,12 @@ namespace MUI window->m_grid->Reorder(window->m_hWnd); for (std::shared_ptr itm : window->m_grid->GetItems()) window->m_grid->Reposition(itm.get()); + for (std::shared_ptr itm : window->m_grid->GetItems()) + { + InvalidateRect(itm->GetComponent()->handle, NULL, FALSE); + UpdateWindow(itm->GetComponent()->handle); + } + } std::vector> dividers = window->m_grid->GetDividers(); for (std::shared_ptr div : dividers)