Getting Color info wihtout loss of data warning

 


Hi

The following is getting me a "Possible loss of data due to type conversion".

// Now retrieve all styles
color  Color1   =         ObjectGet(Label1, OBJPROP_COLOR);

But I can't get it: what could this ObjectGet give other than color data?

 
Ziad El:


Hi

The following is getting me a "Possible loss of data due to type conversion".

But I can't get it: what could this ObjectGet give other than color data?

ObjectGet() returns a double.

You are trying to stuff a double into a color.

It might work; it might not. The compiler doesn't know. So it is giving you a heads up.

To fix it, you can typecast it.

color  Color1   =   (color) ObjectGet(Label1, OBJPROP_COLOR);
 

Thank you Anthony!


That solved it.

Reason: