Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Problem with DependencyProperty (Help)

07 Dec 2018, 10:56

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
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());*/
	}
When I compile, it throw this:
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	
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

Tags:
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: Problem with DependencyProperty (Help)

07 Dec 2018, 14:57

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.
 
User avatar
sfernandez
Site Admin
Posts: 1933
Joined: 22 Dec 2011, 19:20

Re: Problem with DependencyProperty (Help)

07 Dec 2018, 17:48

Please try the following code, it should compile fine with latest 2.2.0b4:
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());
}
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: Problem with DependencyProperty (Help)

07 Dec 2018, 18:10

Thanks, now it is working. It is strange this was working before.
 
User avatar
sfernandez
Site Admin
Posts: 1933
Joined: 22 Dec 2011, 19:20

Re: Problem with DependencyProperty (Help)

07 Dec 2018, 21:32

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: No registered users and 6 guests