Testing for left button click while in a MouseMove Event
Hey y'all,
I'm working on gaining a greater understand of WPF, xaml, and NoesisGui. To that end I'm trying to drag and drop a single red rectangle in canvas element, as per this tutorial I've found online:
https://www.youtube.com/watch?v=THV5BW5WW_o
I am aware of the behaviors-based approach outline in the Noesis Tutorial and sample code, but there are quite a few other xaml concepts in that tutorial which I don't fully understand, so I thought it worthwhile to start a lot simpler.
I've hooked up NoesisGui to register mouse events and I have following xaml setup:
with the following native code:
With the Visual studio debugger I can tell that the MouseMove event is triggered properly. However, the args.leftButton appears to never evaluate to true, despite me verifying that I do pass left clicks on to NoesisGui. Any ideas as to where this is all going side-ways or perhaps how I can debug this further?
Cheers,
Gazoo
I'm working on gaining a greater understand of WPF, xaml, and NoesisGui. To that end I'm trying to drag and drop a single red rectangle in canvas element, as per this tutorial I've found online:
https://www.youtube.com/watch?v=THV5BW5WW_o
I am aware of the behaviors-based approach outline in the Noesis Tutorial and sample code, but there are quite a few other xaml concepts in that tutorial which I don't fully understand, so I thought it worthwhile to start a lot simpler.
I've hooked up NoesisGui to register mouse events and I have following xaml setup:
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="400">
<Border BorderBrush="black" BorderThickness="3">
<Canvas>
<Rectangle
x:Name="RedRectangle"
Canvas.Left="50"
Canvas.Top="50"
Width="50"
Height="50"
Fill="Red" />
</Canvas>
</Border>
</Grid>
Code: Select all
auto rectangle = mXamlGrid->FindName<Noesis::Button>( "RedRectangle" );
rectangle->MouseMove() += [&]( Noesis::BaseComponent* sender, Noesis::MouseEventArgs const& args )
{
if (args.leftButton == Noesis::MouseButtonState::MouseButtonState_Pressed)
{
int horse = 2;
//Noesis::DragDrop::DoDragDrop( rectangle, nullptr, Noesis::DragDropEffects::DragDropEffects_Move );
}
};
Cheers,
Gazoo
[Solved] Re: Testing for left button click while in a MouseMove Event
I'd forgotten that LibCinder differentiates between a mouse moving while a button is not clicked, and a mouse moving while a button *is* clicked. After I hooked up both the mouseMove *and* mouseDrag event to NoesisGui's standard mouse move function, I got the result I was expecting.
Cheers,
Gazoo
Cheers,
Gazoo
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Testing for left button click while in a MouseMove Event
Glad to know it is fixed, closing this then.
Who is online
Users browsing this forum: Google [Bot] and 16 guests