... | ... | @@ -177,4 +177,17 @@ Analogous we can inspect the listener to the horizontal scrollbar, we also notic |
|
|
1. save the position of the scrollbar and store it in the variable ```leftMostPosition``` the value is this time given in pixel
|
|
|
2. update the widget so that the correct text is displayed
|
|
|
|
|
|
both bars are set invisible initially |
|
|
both bars are set invisible initially.
|
|
|
How do we know, whether those bars are not ```null```?. Rememebr when you create a widget in SWT, you have to specify a second argument.
|
|
|
|
|
|
```java
|
|
|
public ATHENEditorWidget(Composite parent, int style) {
|
|
|
|
|
|
```
|
|
|
This second argument are so called stylebits. An ```int``` value is internally made of 32 Bits so we got 32 positions to store a value. This allows for a very flexible styling of a widget. In our case, if the 8th Bit is set, our widget has an horizontal bar and if the 9th Bit is set we got a vertical bar. This is delegated to the canvas constructor which in turn creates those objects for us.
|
|
|
An object with both bits set would require the following call:
|
|
|
|
|
|
```java
|
|
|
new ATHENEditorWidget(parent,SWT.H_SCROLL|SWT.V_SCROLL);
|
|
|
|
|
|
``` |