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 » Tabbing through dynamically created CExtRadioButtons Collapse All
Subject Author Date
Suhai Gyorgy Dec 15, 2006 - 7:41 AM

Dear Support,

Again I’m having problems with CExtRadioButtons and their tabbing. I have a CExtResizableDialog and I’m creating some controls to it dynamically. When creating a CExtRadioButton-group, taborder stops working as should be. I made a little sample to demonstrate the situation. In dialog class’ .cpp file I made some defines, you only have to change those to test different behaviour of pure MFC and Prof-UIS controls. At first startup the correct behaviour can be seen with MFC.

Thank you,
Chris

Technical Support Dec 15, 2006 - 10:31 AM

Thank you for reporting the bug. To fix it, please update the CExtRadioButton::WindowProc() method:

LRESULT CExtRadioButton::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
    if( message == WM_GETDLGCODE )
        return (DLGC_BUTTON | DLGC_RADIOBUTTON);

    if( message == BM_SETCHECK )
    {
        LRESULT lRes = CExtCheckBox::WindowProc( message, wParam, lParam );
        CWnd * pWndParent = GetParent();
        ASSERT_VALID( pWndParent );

        CWnd * pWnd = pWndParent->GetNextDlgGroupItem( this, TRUE );
        while( pWnd != NULL && pWnd != this ) 
        {
            if(        ( pWnd->SendMessage( WM_GETDLGCODE ) & DLGC_RADIOBUTTON ) != 0 
                &&    pWnd->SendMessage( BM_GETCHECK ) == BST_UNCHECKED
                )
                pWnd->ModifyStyle( WS_TABSTOP, 0 );
            pWnd = pWndParent->GetNextDlgGroupItem( pWnd, TRUE );
        }

        pWnd = pWndParent->GetNextDlgGroupItem( this, FALSE );
        while( pWnd != NULL && pWnd != this ) 
        {
            if(        ( pWnd->SendMessage( WM_GETDLGCODE ) & DLGC_RADIOBUTTON ) != 0 
                &&    pWnd->SendMessage( BM_GETCHECK ) == BST_UNCHECKED
                )
                pWnd->ModifyStyle( WS_TABSTOP, 0 );
            pWnd = pWndParent->GetNextDlgGroupItem( pWnd, FALSE );
        }
        bool bCheck = 
            ( wParam != BST_UNCHECKED ) ? true : false;
        this->ModifyStyle( 
            bCheck ? 0 : WS_TABSTOP, 
            bCheck ? WS_TABSTOP : 0
            );        
        return lRes;
    }
    
    return
        CExtCheckBox::WindowProc( message, wParam, lParam );
}