Properties: work around wxVariant / wxAny compatibility issues

This commit is contained in:
Jon Evans 2022-12-01 17:45:41 -05:00
parent e56064696b
commit 307063b9f2
1 changed files with 12 additions and 0 deletions

View File

@ -275,6 +275,18 @@ protected:
void set( void* aObject, T aValue )
{
wxAny a = aValue;
// wxVariant will be type "long" even if the property is supposed to be
// unsigned. Let's trust that we're coming from the property grid where
// we used a UInt editor.
if( std::is_same<T, wxVariant>::value )
{
wxAny pv = getter( aObject );
if( pv.CheckType<unsigned>() )
a = static_cast<unsigned>( static_cast<wxVariant>( aValue ).GetLong() );
}
setter( aObject, a );
}