1

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?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

2 Answers2

1

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.

Community
  • 1
  • 1
Baz
  • 36,440
  • 11
  • 68
  • 94
0

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

Community
  • 1
  • 1
Gangnus
  • 24,044
  • 16
  • 90
  • 149