3 ways,

1, use pan_setbutton.

2, set a variable that's changed once it's clicked, then check that variable when performing operations.

3, create 2 panels, hide that 1 panel and show another.