* Gtk / GtkAda question (TextBuffer insertion)
@ 2020-04-11 13:34 ldries46
2020-04-14 6:37 ` briot.emmanuel
0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2020-04-11 13:34 UTC (permalink / raw)
I do have Program that writes into a GtkTextBuffer. Most of the time
this writing is straight forward line by line but at the end I have a
set of lines that must be inserted at a well defined point.
I can coming along that point Safe the Iter there or do an Add_mark My
problem is how do I put the cursor afterwards back to that position just
to insert the lines lateron
L. Dries
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Gtk / GtkAda question (TextBuffer insertion)
2020-04-11 13:34 Gtk / GtkAda question (TextBuffer insertion) ldries46
@ 2020-04-14 6:37 ` briot.emmanuel
2020-04-14 6:57 ` ldries46
0 siblings, 1 reply; 4+ messages in thread
From: briot.emmanuel @ 2020-04-14 6:37 UTC (permalink / raw)
> I can coming along that point Safe the Iter there or do an Add_mark My
> problem is how do I put the cursor afterwards back to that position just
> to insert the lines lateron
If I remember right, you would set a Gtk_Text_Mark at the position of the cursor, then do the inserts. The mark will remain at the same position automatically. So you can now set the cursor back to where the mark is, and delete the mark
Emmanuel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Gtk / GtkAda question (TextBuffer insertion)
2020-04-14 6:37 ` briot.emmanuel
@ 2020-04-14 6:57 ` ldries46
2020-04-15 7:27 ` briot.emmanuel
0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2020-04-14 6:57 UTC (permalink / raw)
To: briot.emmanuel
Op 14-4-2020 om 8:37 schreef briot.emmanuel@gmail.com:
>> I can coming along that point Safe the Iter there or do an Add_mark My
>> problem is how do I put the cursor afterwards back to that position just
>> to insert the lines lateron
> If I remember right, you would set a Gtk_Text_Mark at the position of the cursor, then do the inserts. The mark will remain at the same position automatically. So you can now set the cursor back to where the mark is, and delete the mark
>
> Emmanuel
That seems logical, but I was searching for the routine the sets the
cursor at the mark.
But at the moment I have rwritten the program, also for other reasons,
to avoid the problem
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Gtk / GtkAda question (TextBuffer insertion)
2020-04-14 6:57 ` ldries46
@ 2020-04-15 7:27 ` briot.emmanuel
0 siblings, 0 replies; 4+ messages in thread
From: briot.emmanuel @ 2020-04-15 7:27 UTC (permalink / raw)
> That seems logical, but I was searching for the routine the sets the
> cursor at the mark.
For reference,
This seems to be `Gtk.Text_Buffer.Create_Mark` (which creates a new mark
at the position of a given Gtk_Text_Iter).
To delete the mark, you would use `Mark.Unref` (or `Glib.Object.Unref (Mark)`)
To get the position of the cursor, you would use `Gtk.Text_Buffer.Get_Insert`
And finally to convert from a mark back to an iter you would use `Gtk.Text_Buffer.Get_Iter_At_Mark`
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-15 7:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11 13:34 Gtk / GtkAda question (TextBuffer insertion) ldries46
2020-04-14 6:37 ` briot.emmanuel
2020-04-14 6:57 ` ldries46
2020-04-15 7:27 ` briot.emmanuel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox