Problem with DependencyProperty (Help)
I want use DependencyProperty, everything looks OK, I copy my old code from old project which was working without problems, I only change the class and naming of objects.
here is code which make trouble: (If I coment problematic code, project is compiled without error and is running ok), I tried Beta4 or 2.1 final, same error
When I compile, it throw this:
here is code which make trouble: (If I coment problematic code, project is compiled without error and is running ok), I tried Beta4 or 2.1 final, same error
Code: Select all
NS_IMPLEMENT_INLINE_REFLECTION(grid_UrhoControl, Noesis::UserControl)
{
NsMeta<Noesis::TypeId>("SumpleUI.grid_UrhoControl");
Noesis::Ptr<Noesis::UIElementData> data = NsMeta<Noesis::UIElementData>(Noesis::TypeOf<SelfClass>()); // !!! this throw error
/*data->RegisterProperty<bool>(b_IsChecked_LightsProperty, "b_IsChecked_Lights",
Noesis::FrameworkPropertyMetadata::Create());*/
}
Code: Select all
Severity Code Description Project File Line Suppression State
Error C2440 'initializing': cannot convert from 'T *' to 'Noesis::Ptr<Noesis::UIElementData>' U3D Noesis Console DX d:\... \grid_urhocontrol.h 59
Code: Select all
1>grid_UrhoControl.cpp
1>d:\...\urho3d test 2018\u3d noesis console dx\grid_urhocontrol.h(59): error C2440: 'initializing': cannot convert from 'T *' to 'Noesis::Ptr<Noesis::UIElementData>'
1> with
1> [
1> T=Noesis::UIElementData
1> ]
1>d:\...\u3d noesis console dx\grid_urhocontrol.h(59): note: Constructor for class 'Noesis::Ptr<Noesis::UIElementData>' is declared 'explicit'
1>d:\programi\development\noesis-gui\noesisgui-nativesdk-2.2.0b4\include\nscore\typeclasscreator.inl(38): note: see reference to function template instantiation 'void grid_UrhoControl::StaticFillClassType<void>(Noesis::TypeClassCreator &)' being compiled
1>d:\...\urho3d test 2018\u3d noesis console dx\grid_urhocontrol.h(56): note: see reference to function template instantiation 'void Noesis::TypeClassCreator::Fill<grid_UrhoControl::SelfClass,grid_UrhoControl::ParentClass>(Noesis::Type *)' being compiled
1>MainWindow.cpp
1>d:\...\games\urho3d test 2018\u3d noesis console dx\grid_urhocontrol.h(59): error C2440: 'initializing': cannot convert from 'T *' to 'Noesis::Ptr<Noesis::UIElementData>'
1> with
1> [
1> T=Noesis::UIElementData
1> ]
1>d:\...\urho3d test 2018\u3d noesis console dx\grid_urhocontrol.h(59): note: Constructor for class 'Noesis::Ptr<Noesis::UIElementData>' is declared 'explicit'
1>d:\programi\development\noesis-gui\noesisgui-nativesdk-2.2.0b4\include\nscore\typeclasscreator.inl(38): note: see reference to function template instantiation 'void grid_UrhoControl::StaticFillClassType<void>(Noesis::TypeClassCreator &)' being compiled
1>d:\...\urho3d test 2018\u3d noesis console dx\grid_urhocontrol.h(56): note: see reference to function template instantiation 'void Noesis::TypeClassCreator::Fill<grid_UrhoControl::SelfClass,grid_UrhoControl::ParentClass>(Noesis::Type *)' being compiled
Re: Problem with DependencyProperty (Help)
Hmm I tested my old project, and same problem. I used VisualStudio 2015 and now I have 2017. But I can't believe this can be problem because I compile my current project, even it run, until I use UIElementData for register DependencyProperty.
-
sfernandez
Site Admin
- Posts: 2995
- Joined:
Re: Problem with DependencyProperty (Help)
Please try the following code, it should compile fine with latest 2.2.0b4:
Code: Select all
NS_IMPLEMENT_INLINE_REFLECTION(grid_UrhoControl, Noesis::UserControl)
{
NsMeta<Noesis::TypeId>("SumpleUI.grid_UrhoControl");
Noesis::UIElementData* data = NsMeta<Noesis::UIElementData>(Noesis::TypeOf<SelfClass>());
data->RegisterProperty<bool>(b_IsChecked_LightsProperty, "b_IsChecked_Lights",
Noesis::FrameworkPropertyMetadata::Create());
}
Re: Problem with DependencyProperty (Help)
Thanks, now it is working. It is strange this was working before.
-
sfernandez
Site Admin
- Posts: 2995
- Joined:
Re: Problem with DependencyProperty (Help)
We changed the return type of NsMeta<T> from Ptr<T> to T* for 2.2 version, that is why it was working before the other way.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 24 guests