LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior of component works controls under VC++ (6.0)!

Hello folks,

Have some weird effects with Component Works controls under VC++ 6.0:

I've created a simple test dialog with a CWButton object (horizontal slide
style) and two CWButton objects (round star LED style). Whenever I switch
the slide position the other LED should light up. I've added an OnClick
message handler:

void CMyView::OnClickCwbuttonChannel()
{
BOOL bSlide=m_cCWButtonSlide.GetValue();

m_cCWButtonLED1.SetValue(!bSlide);
m_cCWButtonLED2.SetValue(bSlide);
TRACE("Switched\n");
}

Pretty simple code and it works fine - as long as you switch the button not
too fast! If you switch it fast then the message handler is not called for
every click (checked by the TRACE output) and so
the LEDs do not light up
properly!!!

This is not acceptable for my project and I'm not used to such strange
behavior from VC++ controls?

What am I doing wrong? How can I fix this "bug"?

Any help appreciated!

Henryk
0 Kudos
Message 1 of 3
(3,389 Views)
I noticed the same thing when I tried to duplicate this. I think the problem
is that fast clicks on the button are interpreted as double clicks instead
of clicks, so that the OnClick handler does not always get called. Try using
the OnValueChanged message handler instead of OnClick. This seems to fix
it. Hope this helps.

Dave

"Henryk Mueller" wrote:
>Hello folks,>>Have some weird effects with Component Works controls under
VC++ 6.0:>>I've created a simple test dialog with a CWButton object (horizontal
slide>style) and two CWButton objects (round star LED style). Whenever I
switch>the slide position the other LED should light up. I've added an OnClick>message
handler:>>void CMyView::OnClickCwbuttonChannel()>{> BOOL bSlide=m_cCWButtonSlide.G
etValue();>>
m_cCWButtonLED1.SetValue(!bSlide);> m_cCWButtonLED2.SetValue(bSlide);> TRACE("Switched\n");>}>>Pretty
simple code and it works fine - as long as you switch the button not>too
fast! If you switch it fast then the message handler is not called for>every
click (checked by the TRACE output) and so the LEDs do not light up>properly!!!>>This
is not acceptable for my project and I'm not used to such strange>behavior
from VC++ controls?>>What am I doing wrong? How can I fix this "bug"?>>Any
help appreciated!>>Henryk>>
0 Kudos
Message 2 of 3
(3,389 Views)
Hey Dave

> I noticed the same thing when I tried to duplicate this. I think the
problem
> is that fast clicks on the button are interpreted as double clicks
instead
> of clicks, so that the OnClick handler does not always get called. Try
using
> the OnValueChanged message handler instead of OnClick. This seems to fix
> it. Hope this helps.

Thank you for your advise! I'll check that out. Have to say that today I
made my very first step on using CW controls. It's all a question of
experience... ;o)

Btw, a message handler for double clicks didn't help (I had the same guess
meanwhile) ....

Ciao

Henryk
0 Kudos
Message 3 of 3
(3,389 Views)