修正combo滚动条处理的一处bug

This commit is contained in:
wangchyz
2016-03-23 17:35:56 +08:00
parent 61247ad10c
commit 3fa8930b42
2 changed files with 20 additions and 4 deletions
+18 -2
View File
@@ -139,6 +139,7 @@ public:
CComboUI* m_pOwner;
CVerticalLayoutUI* m_pLayout;
int m_iOldSel;
bool m_bScrollbarClicked;
};
@@ -147,6 +148,7 @@ void CComboWnd::Init(CComboUI* pOwner)
m_pOwner = pOwner;
m_pLayout = NULL;
m_iOldSel = m_pOwner->GetCurSel();
m_bScrollbarClicked = false;
// Position the popup window in absolute space
SIZE szDrop = m_pOwner->GetDropBoxSize();
@@ -237,12 +239,26 @@ LRESULT CComboWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
else m_pOwner->SetPos(m_pOwner->GetRelativePos(), false);
m_pOwner->SetFocus();
}
else if( uMsg == WM_LBUTTONUP ) {
else if( uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONDBLCLK ) {
POINT pt = { 0 };
::GetCursorPos(&pt);
::ScreenToClient(m_pm.GetPaintWindow(), &pt);
CControlUI* pControl = m_pm.FindControl(pt);
if( pControl && _tcscmp(pControl->GetClass(), DUI_CTR_SCROLLBAR) != 0 ) PostMessage(WM_KILLFOCUS);
if( pControl && _tcscmp(pControl->GetClass(), DUI_CTR_SCROLLBAR) == 0 ) {
m_bScrollbarClicked = true;
}
}
else if( uMsg == WM_LBUTTONUP ) {
if (m_bScrollbarClicked) {
m_bScrollbarClicked = false;
}
else {
POINT pt = { 0 };
::GetCursorPos(&pt);
::ScreenToClient(m_pm.GetPaintWindow(), &pt);
CControlUI* pControl = m_pm.FindControl(pt);
if( pControl && _tcscmp(pControl->GetClass(), DUI_CTR_SCROLLBAR) != 0 ) PostMessage(WM_KILLFOCUS);
}
}
else if( uMsg == WM_KEYDOWN ) {
switch( wParam ) {
+2 -2
View File
@@ -26,10 +26,10 @@
<RichEdit name="testrichedit1" bordercolor="#FF0000" bordersize="2" borderround="8,8" inset="4,2,4,2" bkcolor="#FFE2E5EA" bkcolor2="#FF00F5DA" bkcolor3="#FFF2F5FA" font="1" multiline="false" rich="false" hscrollbar="true" autohscroll="true"/>
<DateTime name="DateTime" width="200" height="30" bkcolor="#FFE2E5EA" padding="0,5,0,0" />
<CheckBox name="CheckBox1" width="20" height="20" bkcolor="#FFEA679F" />
<ComboBox name="ComboBox1" width="200" height="30" bkcolor="#FFEA679F" >
<ComboBox name="ComboBox1" width="200" height="30" bkcolor="#FFEA679F" bordersize="1" bordercolor="0xFFFF0000">
<ListLabelElement text="11111111111111"/>
<ListLabelElement text="22222222222222"/>
<ListLabelElement text="33333333333333"/>
<ListLabelElement text="33333333333333" selected="true"/>
<ListLabelElement text="44444444444444"/>
<ListLabelElement text="55555555555555"/>
<ComboBox height="30" bkcolor="#FF00679F" >