http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/fr//events/io/2011/static/presofiles/gwt_html5_a_web_develops_dream.pdf
look at the DND section.
The data you are passing is to be received by the "drop target", not
the widget you are dragging.
In brief you need to:
- create draggable widget : setDraggable + addDragStartHandler
- create drop target : addDragOverHandler, addDropHandler
Hope this helps ;)
Ludovit
On 11 fév, 15:24, colin <colinzhao...@yahoo.com> wrote:
> Has anyone used newDragandDropfeature with 2.4? I have it work
> all fine except the string data set on the event in DragStartHandler
> is not passed to the event in other handlers. getData always returns
> null.
>
> navLabel.getElement().setDraggable(Element.DRAGGABLE_TRUE);
> navLabel.addDragStartHandler(new DragStartHandler() {
>
> @Override
> public void onDragStart(DragStartEvent event) {
> event.setData("text", navContent.getId()); //I want to pass the
> obejct id
>
> navLabel.addStyleName("s-ContentTOCItem");
> event.getDataTransfer().setDragImage(navLabel.getElement(),
> 10, 10);
> navLabel.removeStyleName("s-ContentTOCItem");
> String text = event.getData("text"); //Since I am getting the null
> data in other DnD event, I want to test it here
> System.out.println("Dragtext: "+text); //text is null. Data is
> not stored.
>
> }
>
> });
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment