Is CBitmapButton the right tool for a push like checkbox?

"addicted2freefall" <addicted2freefall-/[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <[email protected]>
I'm creating a custom window in WTL to hold video controls for a DirectShow app.  I'm first prototyping the window using a dialog.

I've created a set of check boxes that I wish to behave in the "push like" manner (BS_PUSHLIKE).  They appear defined in the .rc file for the dialog like so:

    CONTROL         "",IDC_VID1,"Button",BS_AUTOCHECKBOX | BS_BITMAP | BS_PUSHLIKE | WS_GROUP | WS_TABSTOP,6,7,19,18

I've also loaded an image list for the button, which correctly shows the appropriate image when the button is in mouse button down and up states.

In the code below, m_btnVid1 is defined as a CBitmapButton:

    m_ilBtnVid1.CreateFromImage( IDB_TV, 25, 1, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION );
    m_btnVid1.SubclassWindow( (HWND) ::GetDlgItem(m_hWnd, IDC_VID1) );
    m_btnVid1.SetImageList( m_ilBtnVid1.m_hImageList );
    m_btnVid1.SetImages(0,1);



When clicking on this button, as soon as I release the mouse button, the checkboxes state reverts to "unchecked" state.

I've added a COMMAND_ID_HANDLER_EX to the IDC_VID1 control to determine the state of the control, but the nState variable always reads 0, even after I've explicitly set the check in code:

    void OnVid1(UINT uNotifyCode, int nID, CWindow wndCtl)
	{		
		CBitmapButton* btn = &m_btnVid1;
		int	nState = btn->GetCheck();		

		switch( nState )
		{
			case BST_UNCHECKED:
				btn->SetCheck( BST_CHECKED );
				nState = btn->GetCheck();
				break;

			default:
				btn->SetCheck( BST_UNCHECKED );
				break;
		}
	}

Can anyone suggest why this might be - am I missing a creation style in the CBitmapButton?

If it helps, I'm sure I can post the VC2008 solution file online somehow.



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.