OK, I was able to reproduce your possible problems with Debian 10 'Buster' x86 and LXDE using PB 5.72 x86. When setting the subsystem in my example from above to gtk2, the program stopped compiling with the following error message:
PureBasic error message wrote:
[WARNING] Gtk (ERROR): GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
The compilation with GTK3 worked like a charm and scrolling to the last line worked.
In order to work equally well with GTK2 and GTK3 I had to import all 3 API functions:
Code:
EnableExplicit
ImportC ""
gtk_text_buffer_get_iter_at_line(*TextBuffer.GtkTextBuffer, *Iter, LineNumber.L)
gtk_text_view_get_buffer(*TextView.GtkTextView)
gtk_text_view_scroll_to_iter(*TextView.GtkTextView, *Iter, WithinMargin.D, UseAlign.I, xAlign.D, yAlign.D)
EndImport
Define i.I
Define Iter.GtkTextIter
Define *TextBuffer.GtkTextBuffer
OpenWindow(0, 100, 100, 180, 120, "EditorGadget", #PB_Window_SystemMenu)
EditorGadget(0, 5, 5, WindowWidth(0) - 10, WindowHeight(0) - 45)
ButtonGadget(1, WindowWidth(0) / 2 - 60, WindowHeight(0) - 33, 120, 25, "Scroll to last line")
For i = 1 To 20
AddGadgetItem(0, - 1, "Line number " + Trim(Str(i)))
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 1 And EventType() = #PB_EventType_LeftClick
*TextBuffer = gtk_text_view_get_buffer(GadgetID(0))
gtk_text_buffer_get_iter_at_line(*TextBuffer, @Iter, CountGadgetItems(0) - 1)
gtk_text_view_scroll_to_iter(GadgetID(0), Iter, 0.0, #False, 0.0, 0.0)
EndIf
EndSelect
ForEver