This should take 3 events to sort out. If you need the behavior to apply to many different objects then just put them in a group and apply these events to the group instead:
If Group.X < 0 then Group.X = 0
If Group.X > LayoutWidth then Group.X = LayoutWidth
If Group.Y > LayoutHeight then Group.Y = LayoutHeight
Of course you can tweak the zero or layout measurements for your sprite width or add a buffer if that suits the effect you're after. If you are using physics then it gets a little more complicated only in that you will need to set your physics velocity to zero to stop the object from repeatedly trying to exit the screen.