I have a function that needs a reference as a parameter like
Editfield( BYTE& value, .... )
works OK as long I use direct access in getter /setter with BYTE& as return like
__declspec (property (put = _SetPropsText, get = _GetPropsText)) BYTE propsText;
void _SetPropsText(BYTE val) { ((BYTE*)&props_new)[1] = val; }
BYTE& _GetPropsText() { return ((BYTE*)&props_new)[1]; };
But at all I don´t understand the function of getter and setter because removing the & in the getter fails:
__declspec (property (put = _SetPropsText, get = _GetPropsText)) BYTE propsText;
void _SetPropsText(BYTE val) { ((BYTE*)&props_new)[1] = val; }
BYTE _GetPropsText() { return ((BYTE*)&props_new)[1]; };
does NOT work or function calls!
It is OK using things like:
propsText= 12;
but never works as a referce in a call as parameter
The problem I cannot resolve is, when I use calculation in my getter/setter like:
__declspec (property (put = _SetPropsTextSize, get = _GetPropsTextSize)) float propsTextSize;
void _SetPropsTextSize(const float val) { ((BYTE*)&props_new)[2] = (BYTE)(val*10); }
float _GetPropsTextSize() const { return ((float)((BYTE*)&props_new)[2]) / 10; };
and then call
EditFloat( float& , ...)
EditFloat( propsTextSize, ...)
any idea to overcome this?
What I have tried:
I have no idea to overcome this, imho it works in C# but not in C++?
A temp var does not solve it becuase the setter is not called when the temp var will be changed
when ever there is a "=" teh Setter is called, but when there is a & the getter is called
(checked with debug)