Suzan Cioc
Suzan Cioc

Reputation: 30097

How to create my custom SWT control selectable?

I can make control extending Composite or Canvas.

How to make it selectable? I.e. how to make it behave like Button? Button is disabled for extend. I see a lot of unportable code inside it.

So how to make Button-like control of myself?

Should I process mouse and keyboard events myself or there is some premade functionality to utilize?

Upvotes: 1

Views: 493

Answers (2)

Baz
Baz

Reputation: 36884

You will have to handle the events yourself. I'll give you a couple of hints and references here:

  1. First of all, make sure you read this: Creating Your Own Widgets using SWT
  2. Have a look at SquareButton. It's a custom Button widget and should contain all the code you need.
  3. Here is a very related SO question.

Hope this helps.

Upvotes: 1

Gangnus
Gangnus

Reputation: 24464

Canvas is for drawing from "inside". So, you have to create your own UI input. As here.

Upvotes: 0

Related Questions