Marko Zadravec
Marko Zadravec

Reputation: 8740

Scout Eclipse click on Label

I need to make click listener to label, but as far I can see there is no method to add MouseListener on.

How to detect click (or double click) on label ?

Marko

Upvotes: 0

Views: 63

Answers (1)

Jmini
Jmini

Reputation: 9507

As far as I know, out of the box it is not possible to detect a mouse action (click, double click) on a label.

A possibility is to define a Button with the style “Link”. This way you can detect click on the link.

Form example with a link

Form example with a link

@Order(3500.0)
public class ALinkButton extends AbstractButton {

  @Override
  protected int getConfiguredDisplayStyle() {
    return DISPLAY_STYLE_LINK;
  }

  @Override
  protected String getConfiguredLabel() {
    return TEXTS.get("ALink");
  }

  @Override
  protected boolean getConfiguredProcessButton() {
    return false;
  }

  @Override
  protected void execClickAction() throws ProcessingException {
    MessageBox.showOkMessage("Test", "link was clicked", null);
  }
}

Upvotes: 1

Related Questions