How to force editor pane to scroll to end
Hi,
This is my first time posting, so I apologize if the format is not correct. I have been using Lispworks for about 9 months, so kind of new still. I have some GUIs I developed that include message areas that are updated periodically. I made them scrollable so the user can look back at old messages. Currently, when the application updates the message area the latest messages are at the bottom and are not visible -- the user must scroll down to seem them. I would like the GUI to automatically scroll to the end whenever a new message is written to the area.
I wrote some code that when invoked by a button will do this, here:
(defmethod scroll-to-end-message-pane ((self executioner-gui))
(let
(
(editor-pane-object (message-pane-of self))
(max-range nil)
(page-size nil)
)
(setf max-range (capi:get-vertical-scroll-parameters editor-pane-object :max-range))
(setf page-size (capi:get-vertical-scroll-parameters editor-pane-object :page-size))
(if (null max-range)
(return-from scroll-to-end-message-pane nil)
)
(if (null page-size)
(return-from scroll-to-end-message-pane nil)
)
(capi:apply-in-pane-process editor-pane-object 'capi:scroll editor-pane-object :vertical :move (- max-range page-size))
)
)
The problem is I want to invoke this function not from a button but automatically after the text is updated. Unfortunately, that does not work. I get this error:
Deleted point #<EDITOR::I-POINT NIL NIL offset 0 40202010FB>
I am guessing I should invoke my function from some callback, such as after the editor pane is updated, to avoid this error, but I cannot figure out how to do that.
Does anyone know how I can do make this work? Or is there a simpler way to keep the latest entries in the text area visible?
Thanks!
Jeff.