[Resolved]Drag and Drop Event

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

kili
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Fri Apr 27, 2007 06:17

[Resolved]Drag and Drop Event

Postby kili » Thu Dec 04, 2008 03:33

Hi, I have some problems with drag and drop events:

I have Drag Containers with their children(StaticImage), I'll call them "A"."B"."C"... in the following content.

Image
(each Green Item is "A" or "B" or "C", and I could drag and drop them to
the empty Grid)

1st question:
I let "A" follow the mouse cursor after "Ctrl+Mouse Left Button" Clicked.
But the Drag Container can't follow the mouse cursor if I move the mouse cursor too fast.
(umm.. this is the issue of Mouse following)

In this picture, the yellow item is which should follow mouse cursor.
Image

I upgrade to 0.6.2 today, and this question couldn't be resolved.

2nd question:
After I let "A" follow the mouse cursor, I couldn't get "DragDropItemEnters","DragDropItemLeaves" or
"DragDropItemDropped" event when I move it to Grids which
have subscribed these 3 events.

--I couldn't get the above events when I move the yellow item,
and it is a DragContainer with StaticImage, too.


3rd question:

Image

I subscribed "MouseButtonUp" to "B", and hope it stack to the Grid(which already has "C") below it
when MouseButtonUp. I used "DragDropItemEnters" and "DragDropItemLeaves" to
remember which Grid "B" above, but when I move "B" to any Grid without leaving it, the
"DragDropItemEnters" and "DragDropItemLeaves" handlers always being called.
This is my log:

10:33:38 ***** Enter some Grid ****
10:33:38 ***** Leave some Grid **** //this is strange
10:33:38 ***** Mouse Button Up ****

So I remembered the Grid and clear it right away.

-- I want to move the item from [0][2] to [1][2] to stack the 2 items,
but I got the log above.



Please Help me... :?
Last edited by kili on Tue Dec 09, 2008 09:56, edited 3 times in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Dec 04, 2008 11:20

Hi,

I'm not certain how you're using the drag and drop - or expecting to use it any way.

I let "A" follow the mouse cursor after "Ctrl+Mouse Left Button" Clicked.

This sounds like you're releasing the mouse button immediately? Kind of clicking to pick it up, rather than actually holding the button and dragging? If that's the case then the drag/drop support does not work like that at the moment (there is an outstanding feature for 'sticky mode' to be added, which will be in 0.7.0). I've never seen an issue where the item being dragged doesn't keep up with the mouse - can you give more info about that? Like are you moving it's position manually (which you shouldn't have to do).

With regards to moving from grid slot to grid slot, this is not automatic, in response to DragDropItemDropped you should then detach the item from the old slot and add to the new slot (the one which get the event) - we do this in the drag & drop sample in CEGUI.

Also, you may want to have setMousePassThroughEnabled set to true on the StaticImages, if you have not done this already (mainly because if you don't have this and are using CEGUI 0.5.x things will stop working completely if you upgrade to 0.6.x ;) ).

I'm not certain this answers your question 100%, but that's because I didn't really understand it, lol.

CE.

kili
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Fri Apr 27, 2007 06:17

Postby kili » Fri Dec 05, 2008 08:59

Hi,

I add some pictures in the last post, hope
this could help you understand my question.

Thank you for helping me.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Drag and Drop Event

Postby CrazyEddie » Fri Dec 05, 2008 10:15

kili wrote:I let "A" follow the mouse cursor after "Ctrl+Mouse Left Button" Clicked.

With regards to this: how are you achieving this? Since it's a behaviour that is not built in to the drag/drop support I think at least part of your issue is stemming from however you are doing this. Until we discover exactly how you are trying to use the drag/drop support, all other attempts to guess what the issue might be are futile.

Does the CEGUI sample application DragDropDemo exhibit the same issue with regards to not keeping up with the mouse? This sample shows the way that drag/drop support works and, in general, the way it should be used. How does your usage differ from what we're doing in there?

CE.

kili
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Fri Apr 27, 2007 06:17

Postby kili » Mon Dec 08, 2008 03:11

I subscribed "MouseClick" to achieve this.
That's because our director hope to do this.
After all, we replace the mouse cursor's image to let the image
follow on.

But the question 3 still not resolved. Only what I did is
drag "B" to the Grid with "C", and Mouse UP.

ps.
The Grid has subscribed "DragDropItemDropped","DragDropItemEnters",
and "DragDropItemLeaves" events, But the Log is

11:01:42 ***** Enter some Grid ****
11:01:42 ***** Leave some Grid ****
11:01:43 ***** Mouse Button Up ****

and no **** Item Dropped *****.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Dec 08, 2008 12:56

How exactly you expect other people to know what you're doing and why something does not work from the vaguest descriptions is completely beyond me. The best I can figure is you're not using the drag and drop component in a supported manner. When used properly the object maintains state that dictates what events get triggered and when, if you're subverting this mechanism, then obviously it will not work the same.

To be honest, I have no idea.

kili
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Fri Apr 27, 2007 06:17

Postby kili » Tue Dec 09, 2008 09:54

I'am sorry for bad description... :oops:
Anyway, I've resolved these problems.

Thank you for replying me. :)


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 11 guests