Hi Patrick,
is it possible to drag & drop buttons, in the same screen or from another screen.
I have an application where you can reservate seats in room.
The owner want to make changes in the room by moving his seats and want to do
the same in the program so that his screen is exactly like his room.
There is way to move images (from an 'old' - changed - PCSOFT WD55 example)
Buttons etc are somewhat more difficult because they have their own 'click-event'
and moving from one window to another i didn't even try ...
Example moving images over a window (WD55)
-------
--> Opening window
Global
ToDrag is composed with
XInit is int // Initial mouse X location
YInit is int // Initial mouse Y location
XPos is int // Frame bottom right location
YPos is int // Frame top left location
Control is string // Name of the control moved
END
Event("Drag","",513) //513=WM_LBUTTONDOWN=left button down
Event("Drag","*.",512)// 512=WM_MOUSEMOVE=mouse move
Event("Drag","*.",514) // 514=WM_LBUTTONUP=left button up
--> Procedure Drag
procedure Drag()
EventNum is int // Number of the event to process
XPos, YPos are int // New control locations
EventNum=_EVE.wMessage // Retrieve the number of the event to process
IF EventNumQ3 THEN// WM_lBUTTONDOWN=left button down
// Retrieve the control name
ToDrag.Control=ObjectInfo("",11)
// Check if the control can be moved *************************
IF ToDrag.Control~="IMAGE1" or ToDrag.Control~="IMAGE2" ...
or ToDrag.Control~="IMAGE3" THEN
// Capture the mouse events (compulsory)
CallDll32("User32", "SetCapture", Handle(""))
// Store the initial mouse location
ToDrag.XInit=LoWord(_EVE.lParam)// Mouse X location
ToDrag.YInit=HiWord(_EVE.lParam)// Mouse Y location
ToDrag.XPos={ToDrag.Control}..Column// Initial control X location
ToDrag.YPos={ToDrag.Control}..Line// Initial control Y location
ELSE
ToDrag.Control=""// No control currently moved
RETURN
END
END
IF EventNumQ2 THEN// WM_MOUSEMOVE=mouse move
// Check that a control is currently moved
IF ToDrag.Control<>"" THEN
// Calculate the new object coordinates
XPos=ToDrag.XPos+(LoWord(_EVE.lParam)-ToDrag.XInit)
YPos=ToDrag.YPos+(HiWord(_EVE.lParam)-ToDrag.YInit)
// Move the control
{ToDrag.Control}..Column=XPos
{ToDrag.Control}..Line=YPos
IF not KeyPress(kpLButton) THEN
EventNumQ4// To simulate a button up
END
END
END
IF EventNumQ4 THEN// WM_lBUTTONUP=left button up
IF ToDrag.Control<>"" THEN
CallDll32("User32", "ReleaseCapture")
ToDrag.Control=""
END
END
--------------------
Greetings
Peter