Browser Drag and Drop



I need help using swt.browser

I am unable to trigger the drag and drop listener from the Browser
object. I need to drop the text and do some calculation from the
browser (locating the nodes) and drop it into the table. That's mean I
will need to implement my own TransferType. However, I can't even let
the browser detect the drag event. The only thing I can use at the
moment is to use onmouseup and onmousedown to cheat it as a drag event,
but when it drops, it can only drop the text that I drag from. Because
I am not able to set the DragTarget. It is from the native. I need it
drop more than just text, but also the node location and such.

final Browser browser = new Browser(group, SWT.BORDER | SWT.MULTI);
setDrag(browser);
browser.setUrl("http://www.yahoo.com";);


public static void setDrag(final Browser browser) {
Transfer[] types = new Transfer[] { TextTransfer.getInstance()
};
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;

final DragSource source = new DragSource(browser, operations);
source.setTransfer(types);
source.addDragListener(new DragSourceListener() {
public void dragStart(DragSourceEvent event) {
System.out.println("dragStart");
event.doit = true;
}

public void dragSetData(DragSourceEvent event) {
System.out.println("dragSetData");
event.data = "mydata";
}

public void dragFinished(DragSourceEvent event) {
if (event.detail == DND.DROP_MOVE)
System.out.println("dragFinished");
}
});
}

.



Relevant Pages

  • Re: Flicker
    ... the FF default and the first thing I do is drag off the Google ... Not sure what IE6 has that was so handy. ... I trim my ie6 toolbar down to 1 line as I ... is the inability to drag a URL to another browser, ...
    (alt.html)
  • Re: Flicker
    ... Not sure what IE6 has that was so handy. ... You can't even drag the refresh button in front of the address bar, Big Bill must have made the decree! ... FF is my main browser, but I still use ie6 for various functions not limited to testing. ... Opera, which I have 3 versions 7-9 for testing has minor but really annoying "features" that keep if from my default. ...
    (alt.html)
  • Re: Firefox - tip for printing pages
    ... >> As FF is my default browser I occasionally need to print out pages. ... Either, if you have a PostScript printer, just drag ... You say drag the file onto the PS ... Alan Leighton ...
    (comp.sys.acorn.apps)
  • Re: ways to drag & drop
    ... For this i inject js code into web browser ... for mousedown/move/up events attached to elements. ... i will attach my own function to the corresponding ... mousedown event which is the starting point of drag & drop. ...
    (comp.lang.javascript)
  • Re: Firefox - tip for printing pages
    ... >>> As FF is my default browser I occasionally need to print out pages. ... Either, if you have a PostScript printer, just drag ... > FireFox but just cant fathom it out. ... You say drag the file onto the PS ...
    (comp.sys.acorn.apps)