Rick
Topic Author
Posts: 50
Joined: 26 Nov 2013, 15:35

Get event by name

17 Apr 2015, 01:27

I'm trying to get an event by it's name and I was pointed to the following code:

const TypeClass* type = button3->GetClassType();
const RoutedEvent* clickEvent = Noesis::Gui::FindRoutedEventRecursive(type, clickEventName);

However, FindRuitedEventRecursive's 2nd parameter isn't a string event name, it's some NsSymbol which isn't making sense to me when I look at it's description.
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: Get event by name

17 Apr 2015, 01:46

We use symbols internally to avoid comparing strings. A symbol is internally an integer. You can create a symbol from string easily:
NsSymbol sym(eventName);
Having said that, that function should be getting a string instead of a symbol. We should avoid exposing those details in the public API whenever possible. Will be fixed.
 
Rick
Topic Author
Posts: 50
Joined: 26 Nov 2013, 15:35

Re: Get event by name

17 Apr 2015, 02:06

Thanks. While you are at it you may want to change this too in event handlers.

NsSymbol eventName = e.routedEvent->GetName();

Otherwise we have to do:

string eventName = NsSymbol(e.routedEvent->GetName()).GetStr();
 
User avatar
jsantos
Site Admin
Posts: 3917
Joined: 20 Jan 2012, 17:18
Contact:

Re: Get event by name

17 Apr 2015, 02:08

Yes, thanks for the feedback.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests