button created using CButton class not working when horizontal line behind button

 
I created a button using the CButton class, when it's created a call a function button.BringToTop() to make sure the button is on top of other objects, I also use this function ObjectSetInteger(0, lineName, OBJPROP_BACK, true), to bring the HLine behind evey other object. When the line is behind the button, the button does not get pressed when clicked on and instead the line gets selected. How to fix this?