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 |
|
Eddie Judson
|
Jun 21, 2006 - 10:23 PM
|
Hi, My program is getting stuck in an infinite loop in the class ExtComboBox::::OnFilterPopupListSyncSelection when there is only one item in the list
It is getting stuck in the loop: // select new item INT nIndex = 0; while( (nIndex = FindStringExact( nIndex, sItemText) ) != CB_ERR ) { if( GetItemData( nIndex ) == dwItemData ) { CEdit * pEdit = GetInnerEditCtrl(); ASSERT( pEdit != NULL ); ASSERT_VALID( pEdit ); if( pEdit != NULL ) pEdit->SetRedraw( FALSE ); SetCurSel( nIndex ); // make text non-selected if( !bSetEditSel ) SetEditSel( -1, -1 ); if( pEdit != NULL ) { pEdit->SetRedraw( TRUE ); pEdit->Invalidate(); pEdit->UpdateWindow(); } break; } }
as GetItemData( nIndex ) == dwItemData is not true and nIndex=0 as there is only one item
Regards, Eddie
|
|
Eddie Judson
|
Jun 21, 2006 - 10:43 PM
|
I don’t know if this is the correct way to fix the problem but I updated the method with the following and rebuilt the library
// select new item INT nIndex = 0; INT nRepCount=0; while( (nIndex = FindStringExact( nIndex, sItemText) ) != CB_ERR ) { if( GetItemData( nIndex ) == dwItemData || (nRepCount>0 && nIndex==0)) { CEdit * pEdit = GetInnerEditCtrl(); ASSERT( pEdit != NULL ); ASSERT_VALID( pEdit ); if( pEdit != NULL ) pEdit->SetRedraw( FALSE ); SetCurSel( nIndex ); // make text non-selected if( !bSetEditSel ) SetEditSel( -1, -1 ); if( pEdit != NULL ) { pEdit->SetRedraw( TRUE ); pEdit->Invalidate(); pEdit->UpdateWindow(); } break; } nRepCount++; }
|
|
Technical Support
|
Jun 22, 2006 - 11:15 AM
|
We failed to reproduce the infinite loop. How do you initialize the combo box? Would you send us the code or a test project?
|
|