aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/HelloWorld
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-13 10:35:36 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-13 10:35:36 +0200
commite6945d8495adfa3d33d33c2e49916be79993698d (patch)
tree968a1cca224db50bc14cd351960e37e6fd5cd206 /Samples/HelloWorld
parent74d1288c9990bb251b7097b225891bafdc6758af (diff)
embedded mouse cursors
Diffstat (limited to 'Samples/HelloWorld')
-rw-r--r--Samples/HelloWorld/main.cs36
-rw-r--r--Samples/HelloWorld/ui/helloworld.crow4
2 files changed, 6 insertions, 34 deletions
diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs
index 0089943e..44ec3fb8 100644
--- a/Samples/HelloWorld/main.cs
+++ b/Samples/HelloWorld/main.cs
@@ -3,40 +3,12 @@ using Crow;
namespace HelloWorld
{
- class Program : Interface {
- Command CMDQuit;
+ class Program {
static void Main (string[] args) {
- using (Program vke = new Program ()) {
- vke.Run ();
+ using (Interface app = new Interface ()) {
+ app.Initialized += (sender, e) => (sender as Interface).Load ("#HelloWorld.helloworld.crow");
+ app.Run ();
}
}
- protected override void Startup ()
- {
- CMDQuit = new Command (new Action (Quit)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") };
-
- Widget w = Load ("#HelloWorld.helloworld.crow");
- w.KeyPress += W_KeyPress;
- w.DataSource = this;
- }
-
- Color [] colors = { Color.Blue, Color.DarkGoldenRod, Color.Red, Color.Azure, Color.Brown, Color.Black, Color.White, Color.Pink };
- int ptr = 0;
-
- void W_KeyPress (object sender, KeyPressEventArgs e)
- {
- switch (e.KeyChar) {
- case 'w':
- LoadIMLFragment ($"<DockWindow Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
- break;
- case 'x':
- LoadIMLFragment ($"<Window Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
- break;
- }
-
- ptr++;
- if (ptr == colors.Length)
- ptr = 0;
- }
-
}
}
diff --git a/Samples/HelloWorld/ui/helloworld.crow b/Samples/HelloWorld/ui/helloworld.crow
index cb1b8887..2d7a3176 100644
--- a/Samples/HelloWorld/ui/helloworld.crow
+++ b/Samples/HelloWorld/ui/helloworld.crow
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<Window>
- <Label Text="Hello World"/>
+<Window Width="200" Height="200">
+ <TextBox Text="Hello World" Background="Blue"/>
</Window>