I currently don't know a MacOS API solution, but if you know how many lines are
displayed inside your EditorGadget (for example by means of a counter), you may
simply use
Code: Select all
LastLineContent = GetGadgetItemText(GadgetID, LastLine)
to read the last line and write the last line back unchanged with
Code: Select all
SetGagdetItemText(GadgetID, LastLine, LastLineContent)
to position the last line as the last visible line at the bottom of the EditorGadget.
This approach is not very elegant but should even work crossplatform:
Code: Select all
OpenWindow(0, 0, 0, 310, 170, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 5, 5, WindowWidth(0) - 10, WindowHeight(0) - 30)
ButtonGadget(1, (WindowWidth(0) - 150) / 2 , WindowHeight(0) - 25, 150, 20, "Scroll to last line")
For i = 0 To 25
AddGadgetItem(0, i, "Line "+Str(i))
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 1
SetGadgetItemText(0, 25, GetGadgetItemText(0, 25))
EndIf
EndSelect
ForEver
Update: Sorry, but the crossplatform assumption was wrong. This approach only works
for MacOS X but not for Windows or Linux.