Button aesthetics

 

Hi;

Wrote this code to display two buttons that represent an OFF/ON switch.  They work as intended.

With both buttons set to OFF mode they are the same exact size.  However when I press one of
the buttons to change its mode, the button clicked seems to appear larger and is no longer in
exact alignment with the other.

Does anyone know why this is so?

     // auto trade OFF toggle switch     
     ObjectCreate  ("OFFbut",OBJ_BUTTON,0,0,0);
     ObjectSetText ("OFFbut","OFF",8, "Arial",White);       
     ObjectSet     ("OFFbut",OBJPROP_CORNER, 2);   // bottom left corner  
     ObjectSet     ("OFFbut",OBJPROP_XDISTANCE,168);
     ObjectSet     ("OFFbut",OBJPROP_YDISTANCE,315);
     ObjectSet     ("OFFbut",OBJPROP_XSIZE,40);           
     ObjectSet     ("OFFbut",OBJPROP_YSIZE,32);        
     ObjectSet     ("OFFbut",OBJPROP_BGCOLOR,clrLightGray);    
     ObjectSet ("OFFbut",OBJPROP_COLOR,Black);      
     if (manualMode==true) {
        ObjectSet ("OFFbut",OBJPROP_COLOR,White);     
        ObjectSet ("OFFbut",OBJPROP_BGCOLOR,Red);        
     }            
     
     // auto trade ON toggle switch
     ObjectCreate  ("ONbut",OBJ_BUTTON,0,0,0);
     ObjectSetText ("ONbut","ON",8, "Arial",White);       
     ObjectSet     ("ONbut",OBJPROP_CORNER, 2);   // bottom left corner  
     ObjectSet     ("ONbut",OBJPROP_XDISTANCE,210);
     ObjectSet     ("ONbut",OBJPROP_YDISTANCE,315);
     ObjectSet     ("ONbut",OBJPROP_XSIZE,40);           
     ObjectSet     ("ONbut",OBJPROP_YSIZE,32);        
     ObjectSet     ("ONbut",OBJPROP_BGCOLOR,clrLightGray);     
     ObjectSet ("ONbut",OBJPROP_COLOR,Black);     
     if (manualMode==false) {
        ObjectSet ("ONbut",OBJPROP_COLOR,White);     
        ObjectSet ("ONbut",OBJPROP_BGCOLOR,Green);                   
     }  



Thanks in advance for the guidance.

 

I figured it out.  The deceiving misalignment is caused by the border color that is automatically part of the button.

A darker color button generates a darker color border and that fixed it.


Thanks

Reason: