Code to make stacked/layered widgets come to front

Hi everyone! I have three widgets that are lying on top on one another. I want the clicked widget to come to the front/top layer. Is there any way to do this?