Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » CExtComboBoxBase::OnCBGetItemData Collapse All
Subject Author Date
Stephan Finkler May 25, 2007 - 6:34 AM

Hi,
I’ve got a problem with the new v2.70. If I call GetItemData() of a CExtComboBox I always get 0 returned.

DefWindowProc returns the correct value. In an older version there was
a IsPopupListSupported() call before.


new code:

LRESULT CExtComboBoxBase::OnCBGetItemData( WPARAM wParam, LPARAM lParam )
{
    ASSERT_VALID( this );
LRESULT lResult = DefWindowProc( CB_GETITEMDATA, wParam, lParam );
    if( lResult != CB_ERR )        
    {
        LB_ITEM * pItemDataExt = (LB_ITEM *) lResult;
        ASSERT( pItemDataExt != NULL );
        if(        pItemDataExt != NULL
            &&    AfxIsMemoryBlock(
                    static_cast < LPVOID > ( pItemDataExt ),
                    sizeof( LB_ITEM )
                    )
            )
            lResult = pItemDataExt->DataGet();
        else
            lResult = 0L;
    }
    return lResult;
}


old code:

LRESULT CExtComboBoxBase::OnCBGetItemData( WPARAM wParam, LPARAM lParam )
{
    ASSERT_VALID( this );
LRESULT lResult = DefWindowProc( CB_GETITEMDATA, wParam, lParam );
    if(        lResult != CB_ERR
        &&    IsPopupListSupported()
        )        
    {
        LB_ITEM * pItemDataExt = (LB_ITEM *) lResult;
        ASSERT( pItemDataExt != NULL );
        if(        pItemDataExt != NULL
            &&    ::AfxIsValidAddress(
                    static_cast < LPVOID > ( pItemDataExt ),
                    sizeof( LB_ITEM )
                    )
            )
            lResult = pItemDataExt->DataGet();
        else
            lResult = 0L;
    }
    return lResult;
}


Any idea?

Thanks for any help!

Best regards
Michael

Technical Support May 26, 2007 - 11:02 AM

There are many combo boxes in our samples and they all work OK. For example on the Buttons page in the Prof-UIS_Controls sample there is a Cursor combo box (IDC_CURSOR). During its initialization we assign user data to its items and then analyze it in the CPageButtons::OnSelendokCursor() method when THE selection changes. We would recommend you look at this sample and compare both combo boxes.