In the UIR editor set a callback for the panel (Edit >> Panel... menu or double-click on an empty place inside the panel), and it the panel callback trap EVENT_LEFT_CLICK or EVENT_RIGHT_CLICK or whichever event you decide: use SetPanelAttribute (panel, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE) to enlarge the panel, VAL_MINIMIZE to reduce to icon and VAL_NO_ZOOM to restore to original dimensions.
Be careful that if you click on a control with a collback associated to it, the control callback will be triggered, not the panel callback.