|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Oliver Rau
|
Feb 8, 2008 - 6:30 AM
|
Dear ProfUIS-Team,
using cursor keys CExtComboBox does not repaint the list box correctly. Therefore we needed to modify the original source code in ExtComboBox.cpp to achieve the correct behaviour: void CExtComboBoxPopupListBox::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
{
ASSERT_VALID( this );
if( m_pCB->GetDroppedState() )
{
DWORD dwComboBoxType = m_pCB->GetStyle() & 0x0003L;
CListBox * pListBox = ( CListBox * ) this;
bool bSelChanged = false;
switch( nChar )
{
case VK_LEFT:
case VK_UP:
{
// Go up until we find a valid selection
// then set the current selection to that one
INT nCurSel = pListBox->GetCurSel();
INT nSel = nCurSel;
bool bInitSelection = false;
INT nCount = pListBox->GetCount();
if( nSel < 0 && nCount > 0 )
{
nSel = nCount - 1;
bInitSelection = true;
}
if( nSel != LB_ERR )
{
while( nSel > 0 )
{
INT nItem = nSel - ( bInitSelection ? 0 : 1 );
if( m_pCB->LbItemIsEnabled( nItem ) )
{
if( nCurSel != nItem )
{
// ---------- START MODIFIED SOURCE CODE (1/2) -----------
// pListBox->SetRedraw( FALSE ); // original position
INT nRealSel = pListBox->SetCurSel( nItem );
pListBox->SetRedraw( FALSE ); // new position
// ---------- END MODIFIED SOURCE CODE (1/2) -----------
if( nCurSel != nRealSel )
{
if( dwComboBoxType == CBS_DROPDOWNLIST )
{
INT nTopIndex = pListBox->GetTopIndex();
m_pCB->SetCurSel( nRealSel );
pListBox->SetTopIndex( nTopIndex );
}
else
{
CString sText;
pListBox->GetText( nRealSel, sText );
m_pCB->SetWindowText( sText );
m_pCB->SetEditSel( 0, -1 );
}
bSelChanged = true;
}
pListBox->SetRedraw( TRUE );
pListBox->RedrawWindow(
NULL,
NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME
);
}
break;
}
nSel--;
}
}
}
break;
case VK_RIGHT:
case VK_DOWN:
{
// Go up until we find a valid selection
// then set the current selection to that one
INT nCurSel = pListBox->GetCurSel();
INT nSel = nCurSel;
bool bInitSelection = false;
INT nCount = pListBox->GetCount();
if( nSel < 0 && nCount > 0 )
{
nSel = 0;
bInitSelection = true;
}
if( nSel != LB_ERR )
{
while( nSel < nCount - 1 )
{
INT nItem = nSel + ( bInitSelection ? 0 : 1 );
if( nItem == nCount )
break;
if( m_pCB->LbItemIsEnabled( nItem ) )
{
if( nCurSel != nItem )
{
// ---------- MODIFIED SOURCE CODE (2/2) -----------
// pListBox->SetRedraw( FALSE ); // original position
INT nRealSel = pListBox->SetCurSel( nItem );
pListBox->SetRedraw( FALSE ); // new position
// ---------- END MODIFIED SOURCE CODE (2/2) -----------
if( nCurSel != nRealSel )
{
if( dwComboBoxType == CBS_DROPDOWNLIST )
{
INT nTopIndex = pListBox->GetTopIndex();
m_pCB->SetCurSel( nRealSel );
pListBox->SetTopIndex( nTopIndex );
}
else
{
CString sText;
pListBox->GetText( nRealSel, sText );
m_pCB->SetWindowText( sText );
m_pCB->SetEditSel( 0, -1 );
}
bSelChanged = true;
}
pListBox->SetRedraw( TRUE );
pListBox->RedrawWindow(
NULL,
NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME
);
}
break;
}
nSel++;
}
}
}
break;
case VK_HOME:
case VK_PRIOR:
[...] It would be nice if we could put aside these customizations with the next ProfUIS release. Best regards, Martin
|
|
Technical Support
|
Feb 11, 2008 - 6:38 AM
|
We confirm this issue and already fixed it. Please request the updated source code via email. Additionally, we implemented a new CExtNCSB template class which can be used for skinning the non-client area based scroll bars of any window. This template class is now used by the list box inside the child combo box and popup list box of drop list/dropdown combo boxes.
|
|