To detect a mouseclick you can use the event property of a panel. Then you have to start a while-loop assuming the mouseposition to the panel...
Code:
void dragPanel(PANEL *clickedPan) {
   while(mouse_left == 1) {   //dragging the panel while holding the mousebutton
      clickedPan.pos_x = mouse_pos.x
      clickedPan.pos_y = mouse_pos.y
      wait(1);
   }
}

PANEL *some_pan = {
   pos_x = 0;
   pos_y = 0;
   bmap = XYZ;
   flags = SHOW;
   event = dragPanel;
}



Hope it helps wink
Gor Na Kosh