Nadogail, as for drilling studs I've seen wires ran when you drill through the 2" direction of the stud but not the 4" direction. Compared to the picture the light is mounted centered where the black wire goes through the stack of studs.
For mounting a box, are you saying to recess a pancake...