Sorry, my English eh....hm...

Like:
rmb on entity to change it> panel apear on screen,
i i click on panel buttons to change entity(ok we allready have that in your code)
But, when ((panel is on screen)) i (exidently or on purpose)click enywhere
else in the screen (not on panel),i would like for pannel and mouse pointer to disapear "automaticly"