The reason that you see a tooltip that says CWButton is because CNiButton is a C++ interface on top of an ActiveX control called CWButton, and the dialog editor is hosting the control as an ActiveX control.
The reason for the behavior that you're seeing with the ValueChanged event is that the ValueChanged event fires both when you change the value interactively and when you change the value programmatically. The first time through your event handler is a result of an interactive change, but then you change the value in your event handler, which results in the event firing again, hence the appearance that it's jumping out of the handler and reentering the handler.
You could work around this by having a boolean member variable in your class that tracks w
hether you've entered the event handler and then check this flag in the event handler to prevent executing the code again when you set the Value property. For example, assuming you have a boolean member variable called m_inHandler whose value is set to false in the constructor:
void CCppButtonTestDlg::OnValueChanged(BOOL Value)
{
if (!m_inHandler)
{
m_inHandler = true;
// Make changes to Value property here ...
m_inHandler = false;
}
}
- Elton