Re: Clarification needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

16.05.2016 00:26 Igor Korot <ikorot01@xxxxxxxxx> wrote:
>
> Hi, ALL,
> In the
> https://developer.gnome.org/gtk3/stable/GtkTextView.html#GtkTextView-move-cursor
> it said:
>
> [quote]
> Applications should not connect to it, but may emit it with
> g_signal_emit_by_name() if they need to control the cursor
> programmatically.
> [/quote]
>
> If this signal is not meant to be connected, how come it is documented?
>
> And if it is documented, does this mean I can connect to it and it will work?

First of all, GtkTextView framework is pretty complex and I am by no means
an expert so I may be wrong about what I write here. "move-cursor" signal
is meant for keybinding, it is emitted when a user presses arrow keys,
PgUp, PgDn, Home, End, etc. The default implementation moves a cursor
by one character left when the user presses an arrow left key etc.
Of course you can connect if you want a custom behavior, different by
the default. But this is probably not what you want because it handles
only keyboard action, does not handle mouse, touchscreen, etc.

> Or there is another signal I can connect to to catch the cursor movements?

Probably you should retrieve the GtkTextBuffer object:
https://developer.gnome.org/gtk3/stable/GtkTextView.html#gtk-text-view-get-buffer
and then watch its "cursor-position" property:
https://developer.gnome.org/gtk3/stable/GtkTextBuffer.html#GtkTextBuffer--cursor-position
connecting to the "notify::cursor-position" signal.

> Also, what is the difference between this one and "extend-selection"?

"extend-selection" is emitted when the user makes an action which by
default extends the selection, for example presses Shift + arrow keys,
drags the mouse, double clicks, etc. Again, it is not prohibited to
connect to this signal if you don't like the default behavior and
want to change it.

Regards,

Rafal
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux