MattNiznak
Topic Author
Posts: 2
Joined: 14 Oct 2019, 10:17

OnPropertyChanged

09 Nov 2019, 04:37

I'm trying to not have to use the NoesisAPP dll for my project, and I've gotten to the point where I'm trying to bind a property (for a textbox) to a NsString variable. I can set the variable directly with NsStringVar = myconstcharptrvar, but whenever I use the textbox to reflect back information, the mpBegin == "" and mpEnd = "myString"... I'm wondering if because i'm not using noesisAPP.dll and as such am defining my own iNotifyPropertyBase class (which doesn't have a "OnPropertyChanged(const char* var)" function, I might be missing something?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 1680
Joined: 22 Dec 2011, 19:20

Re: OnPropertyChanged

13 Nov 2019, 09:41

Hi, sorry but I don't understand exactly what you are trying to explain, could you please elaborate a bit more, maybe adding your class definition.
 
User avatar
jsantos
Site Admin
Posts: 2603
Joined: 20 Jan 2012, 17:18
Contact:

Re: OnPropertyChanged

13 Nov 2019, 11:36

Just an important clarification, NoesisApp is a layer we created for our demos and to showcase integration scenarios. It is not needed at all for any fundamental functionality of Noesis. In fact we do not recommend using NoesisApp in your own applications or games.
 
MattNiznak
Topic Author
Posts: 2
Joined: 14 Oct 2019, 10:17

Re: OnPropertyChanged

Yesterday, 04:56

So I figured it out... it was me implementing NotifyPropertyChangedBase... I had:

class NotifyPropertyChangedBase : public Noesis::INotifyPropertyChanged, public Noesis::BaseComponent

with

NS_IMPLEMENT_INLINE_REFLECTION(WpfApp::NotifyPropertyChangedBase, INotifyPropertyChanged)

and while this ran, the reflection pushed my data back 8 bytes.

It should have been:

class NotifyPropertyChangedBase : public Noesis::BaseComponent, public Noesis::INotifyPropertyChanged

with

NS_IMPLEMENT_INLINE_REFLECTION(WpfApp::NotifyPropertyChangedBase, Noesis::BaseComponent)


I still had one issue let, however: if I call a setter from inside code, it will change the data value in my Model, but it won't reflect back onto the screen... I assume that there is something to do with "OnPropertyChanged" that your NoesisAPP adds? How do I get it to reflect backwards onto the screen from application? Do I have to track which objects in the xaml operate on the property and tell them to setText?
 
User avatar
sfernandez
Site Admin
Posts: 1680
Joined: 22 Dec 2011, 19:20

Re: OnPropertyChanged

Yesterday, 11:19

That makes sense, you should take a look at the interfaces section in our C++ tutorial: https://www.noesisengine.com/docs/Gui.C ... interfaces
I think you are missing now the NsImpl<INotifyPropertyChanged>(); inside the reflection implementation block. That is required to expose the interface in the reflection, so DynamicCast can work correctly and then bindings can hook to property changes in that object.

Who is online

Users browsing this forum: No registered users and 1 guest