Page 1 of 1

Re: How to make EditorGadget scroll

Posted: Fri Nov 02, 2012 8:07 pm
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

Re: How to make EditorGadget scroll

Posted: Fri Nov 02, 2012 8:56 pm
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

Re: How to make EditorGadget scroll

Posted: Fri Nov 02, 2012 9:06 pm
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: )