New topic: LineNumAtCharPos and ScrollPosition
<http://forums.realsoftware.com/viewtopic.php?t=47394> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message capaho Post subject: LineNumAtCharPos and ScrollPositionPosted: Sun Mar 24, 2013 9:07 pm Joined: Fri Jul 21, 2006 12:28 am Posts: 494 I have an application that reads a log file into a text area when it opens. I want to set the scroll position to the end of the text so that the most recent log entries are visible when the window opens. The following code in the window open event works in OS X but not in Windows: TextArea.ScrollPosition = TextArea.LineNumAtCharPos(TextArea.Text.Len) If I put the code in the window activate event the scroll position is correct in Windows but the text area is blank until the scrollbar is moved by the user as the text doesn't draw until then even though it's read in in the Window open event. What needs to be done in Windows to get this to work properly? _________________ Regards, Carl Capaho Web http://www.capaho.com Top shaosean Post subject: Re: LineNumAtCharPos and ScrollPositionPosted: Sun Mar 24, 2013 10:22 pm Joined: Mon Aug 15, 2011 10:25 pm Posts: 270 I ran in to so many issues with the built-in TextAreas that I just switched to using an HTMLViewer.. I know not a real answer, but it is an alternative if you are so inclined.. _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top capaho Post subject: Re: LineNumAtCharPos and ScrollPositionPosted: Sun Mar 24, 2013 11:00 pm Joined: Fri Jul 21, 2006 12:28 am Posts: 494 shaosean wrote:I ran in to so many issues with the built-in TextAreas that I just switched to using an HTMLViewer.. I know not a real answer, but it is an alternative if you are so inclined.. Thanks for the tip. The TextArea is read only, so replacing it with an HTMLViewer might be an acceptable workaround if I can't find a solution for the TextArea.ScrollPosition problem in Windows. _________________ Regards, Carl Capaho Web http://www.capaho.com Top J.Hansen Post subject: Re: LineNumAtCharPos and ScrollPositionPosted: Tue Mar 26, 2013 6:10 am Joined: Wed Dec 14, 2011 4:20 am Posts: 72 capaho wrote:I have an application that reads a log file into a text area when it opens. I want to set the scroll position to the end of the text so that the most recent log entries are visible when the window opens. The following code in the window open event works in OS X but not in Windows: TextArea.ScrollPosition = TextArea.LineNumAtCharPos(TextArea.Text.Len) If I put the code in the window activate event the scroll position is correct in Windows but the text area is blank until the scrollbar is moved by the user as the text doesn't draw until then even though it's read in in the Window open event. What needs to be done in Windows to get this to work properly? If I'm not mistaken, looks like you are using: TextArea1.text = Your_Logfile If this is the case, try following: TextArea1.Appentext YourLogfile When you use TextArea1.Appentext the scroll position will be in the bottom and you don't need to use your code above Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
