How to make EditorGadget scroll

Mac OSX specific forum
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: How to make EditorGadget scroll

Post by wilbert »

Code: Select all

;run and you will see the items are listed and the last items are visible
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    EditorGadget(0, 8, 8, 306, 133)
    For a = 0 To 15
      AddGadgetItem(0, a, "Line "+Str(a))
    Next
    
    Range.NSRange\location = Len(GetGadgetText(0))
    CocoaMessage(0, GadgetID(0), "scrollRangeToVisible:@", @Range)
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: How to make EditorGadget scroll

Post by WilliamL »

Thanks wilbert!

That works perfectly! :)

I had to add this definition to my procedure (since I am using 'EnableExplicit').

Code: Select all

Define Range.NSRange
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: How to make EditorGadget scroll

Post by wilbert »

I'm glad it works for you.
And you are right about Define .
I usually don't use EnableExplicit (a bit lazy :wink: )
Post Reply