Hi Milind, > I have a wxSyledTextCtrl control and if I set the SetWrapMode to > wxSTC_WRAP_WORD and there are lines that actually wrap then the function > EnsureCaretVisible does not scroll to the caret position. Is there any way to > have wrapping and get this to work?
I remember running into the same issue. Try adding styledTextCtrl:EnsureVisibleEnforcePolicy, as I remember it helping in my case. It also helps if the position is inside a fold. local pos = #styledTextCtrl:GetText() styledTextCtrl:GotoPos(pos) styledTextCtrl:EnsureVisibleEnforcePolicy(styledTextCtrl:LineFromPosition(pos)) --styledTextCtrl:EnsureCaretVisible() styledTextCtrl:SetFocus() I suspect EnsureCaretVisible() may not be necessary in this case. Paul. On Thu, Jul 4, 2024 at 6:16 PM Milind Gupta <milind.gu...@gmail.com> wrote: > > Hi Paul, > I am trying to use the wxStyledTextCtrl and I see an issue and I > was thinking you would know how to get around it. > > I have a wxSyledTextCtrl control and if I set the SetWrapMode to > wxSTC_WRAP_WORD and there are lines that actually wrap then the function > EnsureCaretVisible does not scroll to the caret position. Is there any way to > have wrapping and get this to work? > > My code is attached. > If the line: > styledTextCtrl:SetWrapMode(wxstc.wxSTC_WRAP_WORD) > is removed then there is no problem. But with this line the > EnsureCaretVisible does not scroll all the way to the end. > > Do you know how to get around this problem? > > Thanks, > Milind > > _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users