aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
diff options
context:
space:
mode:
Diffstat (limited to 'Samples')
-rw-r--r--Samples/BasicTests/BasicTests.cs2
-rw-r--r--Samples/dragNdrop/dragNdrop.cs9
-rw-r--r--Samples/dragNdrop/ui/test.crow10
3 files changed, 14 insertions, 7 deletions
diff --git a/Samples/BasicTests/BasicTests.cs b/Samples/BasicTests/BasicTests.cs
index 7e704916..3b4e6bb2 100644
--- a/Samples/BasicTests/BasicTests.cs
+++ b/Samples/BasicTests/BasicTests.cs
@@ -94,7 +94,7 @@ namespace Samples
} catch (Exception ex) {
//(LoadIMLFragment ($"<Label Background='Red' Foreground='White' Height='Fit' Width='Stretched' Multiline='true' VerticalAlignment='Bottom' Margin='5' />") as OldLabel).Text = ex.ToString();
Console.WriteLine (ex);
- //MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException.Message).Modal = true;
+ //MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException.Message).Modal = true;
}
return false;
}
diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs
index 4b063263..29c22f28 100644
--- a/Samples/dragNdrop/dragNdrop.cs
+++ b/Samples/dragNdrop/dragNdrop.cs
@@ -1,3 +1,4 @@
+using System;
using Crow;
using Samples;
using Crow.Drawing;
@@ -29,6 +30,10 @@ namespace tests
private void W_StartDrag (object sender, DragDropEventArgs e) {
Rectangle r = e.DragSource.LastPaintedSlot;
startGroup = e.DragSource.Parent as Group;
+ if (e.DragSource.bmp == null) {
+ Console.WriteLine ($"DragSource surface is null: {e.DragSource}");
+ return;
+ }
Surface dragImg = CreateSurface (ref r);
using (Context gr = new Context(dragImg)) {
@@ -41,7 +46,8 @@ namespace tests
}
private void W_EndDrag (object sender, DragDropEventArgs e) {
lock (UpdateMutex)
- startGroup.AddChild (e.DragSource);
+ startGroup.AddChild (e.DragSource);
+ ClearDragImage ();
}
private void W_DragEnter (object sender, DragDropEventArgs e) {
@@ -54,6 +60,7 @@ namespace tests
}
private void W_Drop (object sender, DragDropEventArgs e) {
//(e.DropTarget as Group).AddChild (e.DragSource);
+ ClearDragImage ();
}
diff --git a/Samples/dragNdrop/ui/test.crow b/Samples/dragNdrop/ui/test.crow
index ce49ea71..026cb482 100644
--- a/Samples/dragNdrop/ui/test.crow
+++ b/Samples/dragNdrop/ui/test.crow
@@ -15,11 +15,11 @@
</HorizontalStack>
</VerticalStack>
<HorizontalStack Margin="20" Name="zone1" Height="100" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave">
- <Widget Name="w1" Background="Blue" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>
- <Widget Name="w2" Background="Red" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
- <Widget Name="w3" Background="Green" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
- <Widget Name="w4" Background="Yellow" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
- <Widget Name="w5" Background="DimGrey" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget CacheEnabled="True" Name="w1" Background="Blue" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>
+ <Widget CacheEnabled="True" Name="w2" Background="Red" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget CacheEnabled="True" Name="w3" Background="Green" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget CacheEnabled="True" Name="w4" Background="Yellow" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget CacheEnabled="True" Name="w5" Background="DimGrey" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
</HorizontalStack>
<Widget Height="20" Focusable="true"/>
<HorizontalStack Margin="20" Name="zone2" Height="150" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave">