org.gnome.gtk
Interface TextBuffer.NotifyCursorPosition
- Enclosing class:
- TextBuffer
public static interface TextBuffer.NotifyCursorPosition
Signal emitted when the cursor-position property changes.
This is a good way to find out that the cursor has moved.
buffer.connect(new TextBuffer.NotifyCursorPosition()) {
public void onNotifyCursorPosition(TextBuffer source) {
final int offset;
offset = buffer.getCursorPosition();
}
});
If you've already got the insert TextMark, then you could
instead do:
buffer.connect(new TextBuffer.NotifyCursorPosition()) {
public void onNotifyCursorPosition(TextBuffer source) {
final TextIter pointer;
final int offset;
pointer = buffer.getIter(insertBound);
offset = buffer.getOffset();
}
});
which amounts to the same thing.
Using the TextBuffer.NotifyCursorPosition
signal is much
more efficient than hooking up to TextBuffer.MarkSet
signals.
- Since:
- 4.0.10
- Author:
- Andrew Cowie
onNotifyCursorPosition
void onNotifyCursorPosition(TextBuffer source)