BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Events in C++

19 Apr 2021, 14:54

Hey, I want to create static events and pass Noesis::Key and I dont know how to make it

I declared
static Noesis::Delegate<Noesis::Key>& KeyDownTest;
But I don't know how to fire it and how to add my method to it, please any example?

Or maybe how I can reach KeyDown/Up events if my class is inheriting NoesisApp::NotifyPropertyChangedBase?
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Events in C++

19 Apr 2021, 16:28

Events Tutorial
Or maybe how I can reach KeyDown/Up events if my class is inheriting NoesisApp::NotifyPropertyChangedBase?
Please, read carefully the tutorial to connect to any event exposed in XAML.
 
BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Re: Events in C++

19 Apr 2021, 17:14

Ok Thanks I understand. Now I have mindfuck. If I have class MainMenu in C++ and its connected to .xaml how and where the object is created and how I can access to him?
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Events in C++

27 Apr 2021, 20:15

The MainMenu object is created when the xaml gets loaded, the XAML parser creates the class referenced by x:Class attribute.
You can access it from the MainMenu code-behind itself, or if it is part of another xaml, you can name the MainMenu element in that xaml and use FindName to get a reference (from the parent xaml code-behind).

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 67 guests