From a46c8d05392cf07c4897f9856e35bcd3f2382b25 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 10 Nov 2018 16:36:23 +0800 Subject: Add parent window constructor. --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 264b3c7c..359b511b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,6 +87,8 @@ int APIENTRY wWinMain( //test 2 + Window child_window(&window); + const auto layout = CreateWithLayout(LayoutSideParams::Exactly(500), LayoutSideParams::Content()); layout->mouse_click_event.AddHandler([layout](cru::ui::events::MouseButtonEventArgs& args) @@ -114,7 +116,11 @@ int APIENTRY wWinMain( { const auto button = Button::Create(); button->GetLayoutParams()->padding = Thickness(20, 5); - button->AddChild(TextBlock::Create(L"button")); + button->AddChild(TextBlock::Create(L"Show child window.")); + button->mouse_click_event.AddHandler([&child_window](auto) + { + child_window.Show(); + }); layout->AddChild(button); } @@ -170,6 +176,7 @@ int APIENTRY wWinMain( window.AddChild(linear_layout); */ + window.Show(); return application.Run(); -- cgit v1.2.3