Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Control change on MouseOver, MouseLeave only, i.e disable StateChange on MouseClick

Hi Everyone,

 

I have made a WPF application with boolean leds, I want to control their state on two events only, MouseEnter and Mouse Leave, my problem is, that the mouse click is still enabled and is changing the state of the control.

 

Being a DaqMx application it is firing an output of a NI IO board

 

I would like to know if there is a way of controlling the boolean only with these events MouseEnter and MouseLeave, or at least removing the changing state(color) of the control when this one is pressed.

 

I tried to set the ClickMode property to hover but in this case it stops firing the MouseEnter and MouseLeave events.

 

Thanks,

 

Best Regards,

0 Kudos
Message 1 of 4
(5,574 Views)

OK,

 

I found a simple solution but maybe not the best if later I want to use the state_change event on these controls.

 

just adding that in the event

 

    Private Sub P02P05_Click(sender As Object, e As RoutedEventArgs) Handles P02P05.Click
        P02P05.Value = Not P02P05.Value
    End Sub

 

If someone has another better solution I'll be greatful.

 

Best Regards.

0 Kudos
Message 2 of 4
(5,570 Views)

From your description, it sounds like you want the Value of an LED to toggle when the mouse enters and leaves the control. You can achieve this by setting the ClickMode property to Hover and IsMomentary to true:


    <ni:LED IsReadOnly="False" ClickMode="Hover" IsMomentary="True" />

~ Paul H
0 Kudos
Message 3 of 4
(5,553 Views)

Hi Paul, 

 

Thanks for your answer, I haven't got time to check that out yet, but I will shortly and keep you posted if it work.

 

Best Regards,

0 Kudos
Message 4 of 4
(5,521 Views)