Lazarus

Programming => Widgetset => Carbon => Topic started by: ProgEd on July 04, 2013, 03:21:35 pm

Title: TMemo: How to force to top SOLVED!
Post by: ProgEd on July 04, 2013, 03:21:35 pm
There is a behavior difference between the Windows and OS X implementation of TMemo that's driving me crazy. I'm using Lazarus 1.0.10 on both Windows (Win 7) and Max (OS X 10.8 ). I load a TMemo field with lots of text. In Windows it stays at the top (where I want it). However, on the Mac it stays at the bottom forcing the user to scroll to the top manually.

I'm not a Mac programmer so I'm not sure how to address this. What I want is for the TMemo field to be positioned at the top as it is in Windows.

Is there a way to accomplish this?

Thanks,
Ed
Title: Re: TMemo: How to force to top
Post by: typo on July 04, 2013, 03:56:46 pm
Probably setting SelStart to zero at the beggining of your program (if the memo already has text). If the user loads it from a file, do the same after that.
Title: Re: TMemo: How to force to top
Post by: ProgEd on July 04, 2013, 04:08:26 pm
Yup, tried that, didn't work.

Thanks for the suggestion!

Ed
Title: Re: TMemo: How to force to top
Post by: jwdietrich on July 04, 2013, 10:37:35 pm
Yup, tried that, didn't work.

Thanks for the suggestion!

Ed

You could try to set SelStart to 0 also in OnActivate and OnShow events.
Title: Re: TMemo: How to force to top SOLVED!
Post by: ProgEd on July 04, 2013, 11:51:54 pm
Okay, it appears the problem was caused by loading the TMemo field in the OnCreate event. By waiting until the OnShow event everything seems to work fine!

One small update -- after the SelStart := 0 you have to do a SetFocus on the control.

Thank you both for your suggestions!

Ed
TinyPortal © 2005-2018