From: Paul K <pau...@gm...> - 2024-07-06 05:29:23
|
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 <mil...@gm...> 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 > > |