Page 2 of 2

Re: EditorGadget auto scroll to last line ...

Posted: Mon Sep 22, 2025 8:06 am
by marc_256
Hi,

I use Randy Walker example and it works very well,
at the same time, I know the length of the received messages ...
Randy Walker wrote: Sat Sep 20, 2025 3:53 am Hi marc... I've always used sendmessage to do that. Unfortunately not cross platform, but works well enough for me in Windows:

Code: Select all

bottom = Len(GetGadgetText(YourGadget))
SendMessage_(GadgetID(YourGadget), #EM_SETSEL, bottom, bottom)
Thanks all for helping,
marc

Re: EditorGadget auto scroll to last line ...

Posted: Mon Sep 22, 2025 7:23 pm
by Randy Walker
marc_256 wrote: Mon Sep 22, 2025 8:06 am Hi,

I use Randy Walker example and it works very well,
at the same time, I know the length of the received messages ...
Randy Walker wrote: Sat Sep 20, 2025 3:53 am Hi marc... I've always used sendmessage to do that. Unfortunately not cross platform, but works well enough for me in Windows:

Code: Select all

bottom = Len(GetGadgetText(YourGadget))
SendMessage_(GadgetID(YourGadget), #EM_SETSEL, bottom, bottom)
Thanks all for helping,
marc
Shouild also note that #EM_SETSEL is used to select text:
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133)
SetGadgetText(0,"Mary had a little lamb.")
SetActiveGadget(0)
bottom = Len(GetGadgetText(0))
SendMessage_(GadgetID(0), #EM_SETSEL, bottom-5, bottom-1)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: EditorGadget auto scroll to last line ...

Posted: Mon Sep 22, 2025 10:58 pm
by Piero
Mindphazer wrote: Sun Sep 21, 2025 5:38 pm
Piero wrote: Sun Sep 21, 2025 4:23 pm
Mindphazer wrote: Sun Sep 21, 2025 2:37 pmon MacOS

Code: Select all

Range.NSRange\location = Len(GetGadgetText(0))
CocoaMessage(0, GadgetID(0), "scrollRangeToVisible:@", @Range)
I know
Rashad was trying to write a code without API calls
Please forgive me: I just wanted to help; the last post when I answered was just windoze gibberish (no multiplatform goodie) :(