Owsap 201 Posted September 18, 2019 Antes de tudo, eu sei que isso é um pouco inútil, mas para ativar e desativar o efeito a piscar nos botões, decidi usar a função de flash padrão, porque não conhecia uma maneira mais fácil. Spoiler EterPythonLib/PythonWindow.cpp /// 1. // Procura void CButton::Flash() { m_isFlash = true; } // Adiciona abaixo void CButton::EnableFlash() { m_isFlash = true; if (!m_overVisual.IsEmpty()) SetCurrentVisual(&m_overVisual); } void CButton::DisableFlash() { m_isFlash = false; if (!m_upVisual.IsEmpty()) SetCurrentVisual(&m_upVisual); } /// 2. // Procura a função void CButton::OnRender() // Substituir por void CButton::OnRender() { if (!IsShow()) return; if (m_pcurVisual) { if (m_isFlash) { if (!IsIn() && !IsPressed()) { if (!m_overVisual.IsEmpty()) SetCurrentVisual(&m_overVisual); if (int(timeGetTime() / 500) % 2) return; } } m_pcurVisual->Render(); } PyCallClassMemberFunc(m_poHandler, "OnRender", BuildEmptyTuple()); } EterPythonLib/PythonWindow.h /// 1. // Procura void Flash(); // Adicionar abaixo void EnableFlash(); void DisableFlash(); EterPythonLib/PythonWindowManagerModule.cpp /// 1. // Procura PyObject * wndButtonFlash(PyObject * poSelf, PyObject * poArgs) { UI::CWindow * pWindow; if (!PyTuple_GetWindow(poArgs, 0, &pWindow)) return Py_BuildException(); ((UI::CButton*)pWindow)->Flash(); return Py_BuildNone(); } // Adiciona abaixo PyObject* wndButtonEnableFlash(PyObject* poSelf, PyObject* poArgs) { UI::CWindow * pWindow; if (!PyTuple_GetWindow(poArgs, 0, &pWindow)) return Py_BuildException(); ((UI::CButton*)pWindow)->EnableFlash(); return Py_BuildNone(); } PyObject* wndButtonDisableFlash(PyObject* poSelf, PyObject* poArgs) { UI::CWindow * pWindow; if (!PyTuple_GetWindow(poArgs, 0, &pWindow)) return Py_BuildException(); ((UI::CButton*)pWindow)->DisableFlash(); return Py_BuildNone(); } /// 2. // Procura { "Flash", wndButtonFlash, METH_VARARGS }, // Adiciona abaixo { "EnableFlash", wndButtonEnableFlash, METH_VARARGS }, { "DisableFlash", wndButtonDisableFlash, METH_VARARGS }, ROOT/ui.py ''' 1. ''' # Procura def Flash(self): wndMgr.Flash(self.hWnd) # Adiciona abaixo def EnableFlash(self): wndMgr.EnableFlash(self.hWnd) def DisableFlash(self): wndMgr.DisableFlash(self.hWnd) Como um exemplo, aqui está uma demonstração do efeito do flash. 3 'ŞŦŘƗƗҜ€Ř', Marcos Pinheiro and NewWars reacted to this Share this post Link to post Share on other sites