@@ -49,10 +49,10 @@ This editor is fully event based, since time does not make sense in this scenari
...
@@ -49,10 +49,10 @@ This editor is fully event based, since time does not make sense in this scenari
Writing such a component is not extremely hard but also requires some thinking. By no means i expect the code which im going to show here to be perfect, but i dont think it is extremely poor either. When writing a widget one needs to think of everything this widget should be capable of, we can list all those things as tasks:
Writing such a component is not extremely hard but also requires some thinking. By no means i expect the code which im going to show here to be perfect, but i dont think it is extremely poor either. When writing a widget one needs to think of everything this widget should be capable of, we can list all those things as tasks:
* changing the display based on the input
* changing the display based on the input
* Managing horizontal and vertical scrollbars if required
* Displaying a mouse cursor in the correct shape as long as it is located over the editor
* Displaying a mouse cursor in the correct shape as long as it is located over the editor
* Displaying the text in different Fonts (that is the type, its size and styling)
* Displaying the text in different Fonts (that is the type, its size and styling)
* Allowing the user to wrap the editor lines, based on the current size of the widget
* Allowing the user to wrap the editor lines, based on the current size of the widget
* Managing horizontal and vertical scrollbars if required
* Managing the caret and displaceing it whenever a click happens to a different location
* Managing the caret and displaceing it whenever a click happens to a different location
...
@@ -138,3 +138,33 @@ This method is yet again very simple in itself. At first it saves the input, the
...
@@ -138,3 +138,33 @@ This method is yet again very simple in itself. At first it saves the input, the
```
```
We leave the method ```initData()``` for later, it is used to initialize Objects that are used in this widget. Teh next important method we need to check is the method ```initEventHandler()``` which is partly discussed in the next section.
## Managing horizontal and vertical scrollbars if required
If one inspects the code of ```initEventHandler()``` one can directly see the handling of the scrollbars.