Embed webcontainers drag and drop

I want to implement drag n drop inside a list made with a webcontainer embedding.
Can’t make it work…
Is there an example somewhere or did you try this ?

Thanks

Have you looked at /Applications/Xojo 2016 Release 3/Example Projects/Web/Drag and Drop/SimpleDragAndDrop.xojo_binary_project ?

Of course, I’ve looked to the 2 examples but my case if different.
I have a grid (webcontainer) embedding cells (webcontainers).
The use of drag’n drop is to reorder cells in the grid.

This is to provide lists (other than WebListBox). BTW, drag and drop don’t work on WebListBox cells or rows.

Indeed, WebListBoxes are off limit. At least in pure Xojo.

Yes exactly.
But then, the problem is to get drag and drop working with the EmbedWith technique.

What you’re asking for should be possible, only the user won’t have any indication of where the drop point will be.

You’ll need to make the rows draggable and the container a drag target. When the drop occurs, you’ll need to figure out where it was dropped and shift the other rows downward.

@Greg O’Lone Should be possible… but seems not bo be :frowning:
Should embedded containers be “draggabled” ?

[quote=299105:@ValryTarondeau]@GregO’Lone Should be possible… but seems not bo be :frowning:
Should embedded containers be “draggabled” ?[/quote]
I think the answer is “it depends what you mean by draggable”.

If your definition is that the user should be able to click and hold on a container and drag it to another location and drop it, then yes, that should work.

Perhaps a sample project showing what you’re trying to do would be helpful?

@Greg O’Lone I got it. The problem is that objects that inherit from WebContainers are not draggable.
If I use a regular WebContainer it works fine.
It seems weird for me. Why does inheriterance affect the drag/drog mechanism ?

Is there a bug report about that with a sample?

No. I was doing it wrong.
If the container has a mousedown event, drag is not fired witch is logical.

No, that’s not logical. Before every drag there is a mousedown and as soon the mouse is moved with the mousedown only then starts the drag.
IMO this is an implementation bug.

No, it is a limitation of the platform. Xojo Web drag operations are based on HTML5 drag and drop, and indeed, implementing MouseDown inhibit the feature.

I don’t think so.
At w3schools you can online modify the example of the HTML5 drag and drop to react also to the mouse down event.

I was talking about Xojo.

I did report the present issue back in 2015 <https://xojo.com/issue/41317>, but Greg closed it :

[quote]Greg O’Lone on Oct 23, 2015 at 4:08 PM
This case has been closed because the behavior described is not a bug.[/quote]

I believe they have an issue because in order to send back MouseDown to Xojo, they hook the event, which results in disabling the drag feature. It may be feasible to do otherwise, but the report closed indicates Xojo is not terribly open to revisit the issue.

Indeed, at the HTML control level, the mousedown event is accessible. I posted already some code here, and below is a very simple snippet to send the event to HashtagChanged :

Me.AllowTextDrag(WebDragItem.DragActionMove) dim js as string js = js + "document.getElementById('"+me.controlid+"').setAttribute('onmousedown','window.location.replace(""#MouseDown"");');" self.ExecuteJavaScript(js)

Ive been trying to create a dashboard type app. i can get containers to be drag-able to wherever the user wants,
however when you release the control, it seems there is no way to offset it by the distance that the user clicked within the control
so it ‘snaps’ to a different place. you cannot get the x and y because you cannot use mouse down/up

you cannot control the area that represents the ‘drag handle’ because you cannot use mouse down/up.

its resulted in something i dont want to use in production which is a shame.

Russ, you need to read here : https://forum.xojo.com/26982-2015r3-web-drag-drag-misconception/0

OH! WOW! it only bloody works!
Wish id seen this before!

Thanks @Michel Bujardet (and Xojo)