Can I change a boolean variable (in object properties) without checking it?

 

Hi all,

when I click on a rectangle, I use this code:

if (ObjectSetInteger(0,"object",OBJPROP_FILL) ObjectSetInteger(0,"object",OBJPROP_FILL,false);
else ObjectSetInteger(0,"object",OBJPROP_FILL,true);

Is it possible to change the property's value directly from false to true or vice versa without checking its state first?

 
   static bool fill=false;
   ObjectSetInteger(0,"object",OBJPROP_FILL,fill=!fill);
 
Marbo:

Hi all,

when I click on a rectangle, I use this code:

Is it possible to change the property's value directly from false to true or vice versa without checking its state first?

Thank you!

 

Yes, you can convert boolen through:

const string = 'string'; !!string; // true Boolean(string); // true

I also use this for my website of hesco bill online.

Reason: