My advice is:
Give your object an instance variable called "picked"
While dragging, set it to 1.
Conditions: every tick, object dragging = 1
Action: object set X= clamp (self.x, leftborder, rightborder)
Action: object set Y= clamp (self.y, upborder, bottomborder)
Obviously, use the coordinates you want to limit in leftborder, rightborder etc. I think this should work, not sure though, don't have c2 under my hand atm.
Clamp function limits a given value between the next two values you give, so I think this will be ok.