Page 1 of 2

Drag-Drop sample

Posted: Thu Jun 08, 2017 7:48 am
by skiman
Hi,

I wnat to use the drag-drop of the buttons. This isn't working as expected.

I added the following to the DRAGDROP.PRG sample.

Code: Select all

@ 0,0 dcpushbuttonxp caption "But 1" title "B1" size 15,2 ;
		DRAG {|oXbp| DC_GetProperty( oXbp, cGETLIST_TITLE ) } ;
		DROP {|oXbp,a| (wtf DC_GetProperty( oXbp, cGETLIST_TITLE ),a) }

@ 0,25 dcpushbuttonxp caption "But 2" title "B2" size 15,2 ;
		DRAG {|oXbp| DC_GetProperty( oXbp, cGETLIST_TITLE ) } ;
		DROP {|oXbp,a| (wtf DC_GetProperty( oXbp, cGETLIST_TITLE ),a) }
I expected that when I drag the Button 1 and drop it to button 2, I would get B1 , B2 in the WTF. It gives me B1 , B1. When I drag Button 2 to Button 1, I get B2, B2.

This isn't according to the documentation.

In attachment the modified dragdrop.prg for an easy test.

Re: Drag-Drop sample

Posted: Thu Jun 08, 2017 8:18 am
by skiman
ok, it seems that a button can't be dropped on another button.

I can drop a line from the browse to the button, then I get the 'assign' sign/cursor. If you try to drop a button to another button, I get the 'forbidden' sign/cursor.

On a touch screen, I need to be able to 'swipe' a button to another button. How can I do this?

Re: Drag-Drop sample

Posted: Tue Jun 13, 2017 1:45 am
by skiman
Hi Roger,

Any idea how I could implement the drag/drop from one button to another?

It looks as it isn't working because of the focus remains on the button where the drag is started. The button where I want to drop, doesn't get focus.

In the source code there is the following:
METHOD DC_GetList:EventLoop

Here you can find : oXbp := SetAppFocus()

This gives the Button where the DRAG is started, because this still has focus.

I was looking for a way to change the focus when you start dragging on a button, but I don't succeed.

Re: Drag-Drop sample

Posted: Tue Jun 13, 2017 7:55 am
by rdonnay
Chris -

I have been overworked lately and decided I needed 3 days of in a cabin in the mountains.
I will be back Thursday night and will see what I can do for you when I get back.
I will not be bringing my computer with me.

Roger

Re: Drag-Drop sample

Posted: Tue Jun 13, 2017 8:15 am
by skiman
Enjoy your trip.

Re: Drag-Drop sample

Posted: Wed Jun 21, 2017 7:33 am
by skiman
Hi Roger,

Did you already had some time to check if you will find a solution to drag a button and drop him on another button?

Re: Drag-Drop sample

Posted: Tue Jun 27, 2017 10:42 am
by rdonnay
I just got back home.

I am trying to understand what you are trying to do.

Your issue is very confusing to me.

Are you saying that when you left click on a pushbutton you don't want it to activate, but instead you want it to drag?

Re: Drag-Drop sample

Posted: Wed Jun 28, 2017 12:07 am
by skiman
Hi Roger,

The drag of the button is working, it is the drop to another button that isn't working.

In the first post I added the dragdrop sample where I added two buttons. If you test this sample you will see the following:
- Drag a button to another button isn't working.
- Drag a button to another object is working.
- Drag another object to a button is working.

Re: Drag-Drop sample

Posted: Wed Jun 28, 2017 12:02 pm
by rdonnay
I am running your program and I can't get anything to work.

Dragging from a button does not do anything.

Re: Drag-Drop sample

Posted: Wed Jun 28, 2017 1:57 pm
by rdonnay
Rather than try to figure out why your sample does not work, I decided instead to add 3 buttons on the DragDrop example that is in the \exp20\samples\dragdrop folder. The file is attached. It works just fine.