How to stop wxTextCtrl from auto scrolling to bottom Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
parad0x13
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Jan 06, 2009 3:09 am

How to stop wxTextCtrl from auto scrolling to bottom

Post by parad0x13 »

I have some code:

Code: Select all

wxString HenonInfo;
HenonInfo = _T("Introduced by Michel Hénon (b. 1931)\nHénon's attractor arose from the study of perturbations in asteroid orbits.\n\nThe facinating detail in the Hénon map show that every single line you see, will eventually diverge into 2 seperate lines; This process will continue infinitum");

Equation_Info->AppendText(HenonInfo);
And it works flawlessly, well at least in practice it does... However the control box is too small to fit the whole strings info at once and so it auto utilizes a scrollbar for viewing. BUT! It scrolls to the bottom of the control box... This is what I wish to fix

Is there a way to auto scroll to the top of the wxTextCtrl box?

- Thank You
User avatar
Disch
Experienced Solver
Experienced Solver
Posts: 99
Joined: Wed Oct 17, 2007 2:01 am

Post by Disch »

Code: Select all

// make the top of the text box visible
myTextCtrl->ShowPosition(0);

// you may also want/need to move the carat to the top of the
//   box with this:
myTextCtrl->SetSelection(0,0);
parad0x13
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Jan 06, 2009 3:09 am

Post by parad0x13 »

Thank you so very very much!

This is exactly what I needed

AGAIN THANK YOU!
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

When your problem is solved, please click "Accept" to give the person credit and close the topic. I did it for you this time :)
Post Reply