Quote: "i was looking at the events but im not sure there is a paneldrag event ?"
There are events for when the user presses the mouse down (LEFTBUTTON_DOWN), moves the mouse (MOUSE_MOVE) and releases the mouse (LEFTBUTTON_UP or MOUSE_CLICK) though. Essentially, the steps are as follows:
- When the user presses the mouse down, and the mouse is over the panel, enable dragging (by setting a variable somewhere) and store the location of the mouse relative to the gadget (using mousePosX( gadget ) and mousePosY( gadget ) )
- When the user moves the mouse, check to see if dragging is enabled, and if it is, reposition the panel based on the current mouse position, taking the original offset into account (positionGadget gadget,mousePosX(panelsParentGadget)-offsetX,mousePosY(panelsParentGadget)-offsetY)
- When the user releases the mouse, disable dragging.
The code then might be something like (off the top of my head, my laptop is in for repair so I cannot test it)
... code to create panels ...
dragging=0
offsetX=0
offsetY=0
do
getEvent
if (eventSource()=panel and eventType()=LEFTBUTTON_DOWN)
dragging=1
offsetX=mousePosX(panelGadget)
offsetY=mousePosY(panelGadget)
endif
if (eventType()=MOUSE_MOVE and dragging=1)
positionGadget panelGadget,mousePosX(panelParent)-offsetX,mousePosY(panelParent)-offsetY
endif
if (eventType()=LEFTBUTTON_UP)
dragging=0
endif
loop
BlueGUI Windows Plugin