Thanks everyone for the assistance. Got one final question for the day, before taking a break -
How do you automatically point the cursor to the end of an Editor Gadget, after your program prints a lot of information on the gadget?
Currently, after the program throws lots of messages at the gadget, you can see the scroll bar, but it remains at the very top of the gadget window. So in order to see the most recent text, you have to scroll down.
How to jump to the end of a scrolled EditorGadget
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: How to jump to the end of a scrolled EditorGadget
Try this:
Code: Select all
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133)
For a = 0 To 50
AddGadgetItem(0, a, "Line "+Str(a))
Next
SetActiveGadget(0)
SendMessage_(GadgetID(0), #WM_KEYDOWN, #VK_END, #Null)
SendMessage_(GadgetID(0), #WM_VSCROLL, #SB_BOTTOM, #Null)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: How to jump to the end of a scrolled EditorGadget
"
SendMessage_(GadgetID(0), #WM_KEYDOWN, #VK_END, #Null)
SendMessage_(GadgetID(0), #WM_VSCROLL, #SB_BOTTOM, #Null)
"
Yep, adding
SendMessage_(GadgetID( edtOutput ), #WM_KEYDOWN, #VK_END, #Null)
SendMessage_(GadgetID( edtOutput ), #WM_VSCROLL, #SB_BOTTOM, #Null)
after every AddGadgetItem( edtOutput...) or SetGadgetText( edtOutput, sOutput )
seem to do the trick, thanks JHP. I'll go ahead and encapsulate all of it in one function.
SendMessage_(GadgetID(0), #WM_KEYDOWN, #VK_END, #Null)
SendMessage_(GadgetID(0), #WM_VSCROLL, #SB_BOTTOM, #Null)
"
Yep, adding
SendMessage_(GadgetID( edtOutput ), #WM_KEYDOWN, #VK_END, #Null)
SendMessage_(GadgetID( edtOutput ), #WM_VSCROLL, #SB_BOTTOM, #Null)
after every AddGadgetItem( edtOutput...) or SetGadgetText( edtOutput, sOutput )
seem to do the trick, thanks JHP. I'll go ahead and encapsulate all of it in one function.