PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD5.5] drag & drop
[WD5.5] drag & drop
Started by Patrick Vandebroek, Oct., 25 2004 5:52 PM - 4 replies
Posted on October, 25 2004 - 5:52 PM
Hey,
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.
Any idea is welcome.
Greetings,
Patrick
Posted on October, 25 2004 - 6:12 PM
Hello Patrik,
my idea : link the mouse postion with the button properties, then move the button like the mouse is moved and save the new properties in a file.
Its only a idea - not tested.
I think drag and drop is not possible.
Christoph
Hey,
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.
Any idea is welcome.
Greetings,
Patrick
Posted on October, 25 2004 - 6:16 PM
Hello Patrick,
I have made smomething like this in another laguage. So it is not testet or made in windev.
I had 20 buttons (or pictures) hidden in a corner (or outside the window)
After a click in the window it moved the button to the desired position and made it visuable.
Regrards Frans
Hey,
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.
Any idea is welcome.
Greetings,
Patrick
Posted on October, 28 2004 - 4:22 PM
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


http://www.boxerart.net
Posted on October, 29 2004 - 12:44 PM
Hi Peter,
this code was very usefull to me. Thanks.
But, the program is not yet working like it should be, because with this code, only the 9 first buttons can be moved.
I have 320 buttons in my window which are called from "button5_1" to "button5_320".
Maybe I have to make a changes here.
Greetings,
Patrick
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