0

I hope to detect the mouse drag the TitleAreaDialog. So I try to add "DragDetectListener" and "MouseListener" to the dialog's shell. I found that when I drag this dialog, it doesn't call this listener. I also try to add "SWT.DragDetect" to shell.getDisplay() but this did not help.

Does anyone add this listener before?

shell.addDragDetectListener(new DragDetectListener() {

  @Override
  public void dragDetected(DragDetectEvent e) {
    System.out.println("dragDetected-------------");
  }
});
greg-449
  • 109,219
  • 232
  • 102
  • 145
neal
  • 1
  • 1

1 Answers1

0

Moving a dialog doesn't trigger drag and drop events.

You can use a ControlListener to be told about move and resize events:

newShell.addControlListener(new ControlListener()
  {
    @Override
    public void controlResized(final ControlEvent e)
    {
      // Resized
    }


    @Override
    public void controlMoved(final ControlEvent e)
    {
      // Moved
    }
  });

Note that you only get the controlMoved call once at the end of moving the dialog.

greg-449
  • 109,219
  • 232
  • 102
  • 145