Lazarus

Programming => Packages and Libraries => RichMemo => Topic started by: Trenatos on April 14, 2016, 09:59:55 pm

Title: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 14, 2016, 09:59:55 pm
I noticed something odd, and I did some tests.

If I create a RichMemo, and programmatically set wordwrap and scrollbars, only the second item gets set.

Example:
RichMemo1.ScrollBars:=ssAutoBoth;
RichMemo1.WordWrap:=false;

The above will only set WordWrap while not changing scrollbars, if I do this:
RichMemo1.WordWrap:=false;
RichMemo1.ScrollBars:=ssAutoBoth;

This time I only get scrollbars and no wordwrap.

I'm guessing this is a bug, but are there any workarounds?

I'm on OSX El Capitan, Lazarus 1.6, Carbon.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 15, 2016, 03:05:29 am
r4621
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 15, 2016, 03:37:38 am
I uninstalled the old one, updated SVN, opened compiled and installed r4621 but looks to be having the same behavior, is there some way I can confirm that the package I'm using is the correct one?

-- Edit

I created a new application, placed a button and a TRichMemo, added a long text, and on the button click handler I do this:
RichMemo1.WordWrap:=false;
RichMemo1.ScrollBars:= ssAutoBoth;

WordWrap turns off, but scrollbars don't seem to work, they also don't work if I set scrollbar option in the object inspector.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 15, 2016, 05:25:36 am
what makes you think scrollbars don't work?
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 15, 2016, 02:03:49 pm
When I set scrollbars programmatically, they don't show up at all, and when I do it with the object inspector, they show up when I do both on, but there's no scroll marker, at least for horizontal (Did not test vertical)
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 18, 2016, 03:57:35 pm
After a little testing, here's the behavior I'm seeing;

If I do this:
currentRichMemo.WordWrap    := false;
currentRichMemo.ScrollBars     := ssAutoBoth ;

WordWrap turns off, and I get a vertical scrollbar which works as it should, but I do not get a horizontal scrollbar even though the text is definitely wider than the richmemo.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 18, 2016, 04:24:36 pm
Well. it's been working like this for awhile.

I cannot find a link now, but I there was some mentioning that horizontal scrollbars won't even show in carbon rich edit. Need to do some more investigations on this.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 18, 2016, 07:11:44 pm
Is there anything I can do to help?

It's the last piece I need working before I can release a piece of software I've been working on, so if there's anything I can do to help, I'm happy to give it a go.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 18, 2016, 07:15:35 pm
Is there anything I can do to help?
don't use wordwrap :D

but seriously... here's a test you could do.
Place TScrollBox on an empty form.
Add TRichMemo into it. Important: Make sure that RichMemo scrollbars are set to ssNone.
Make TRichMemo bigger than TScrollBox itself (so both horizontal and vertical scrollbars should be shown).
Add some text ... and see if Horizontal and Vertical scrollbars are showing up on the ScrollBar.


Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 18, 2016, 08:20:53 pm
Yes that works.

Both scrollbars show up and work (And works with magic mouse too, which Lazarus IDE does not, I filed an error report about that a while back)
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 18, 2016, 09:01:49 pm
magic mouse too
a magic mouse?
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 18, 2016, 10:28:13 pm
Apple wireless buttonless mouse, uses touch sensors for swiping, scrolling, etc.

With it you can scroll horizontally as easily as vertically, but Lazarus has issues with horizontal magic mouse scroll.. BUT it seems to work with the scrollbox, which is odd..
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 18, 2016, 10:34:45 pm
Apple wireless buttonless mouse, uses touch sensors for swiping, scrolling, etc.

With it you can scroll horizontally as easily as vertically, but Lazarus has issues with horizontal magic mouse scroll.. BUT it seems to work with the scrollbox, which is odd..
and what's the bug report # for it?
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 18, 2016, 10:53:14 pm
The id is 0029972
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 19, 2016, 02:23:22 am
Need to do some more investigations on this.
Standard OSX scrolling view is buggy with HITextView (the richedit).
Thus it's necessary to implement own scroll view that would handle horizontal scrolling.

Potentially it should be possible, since TScrollBox works for you, which is implemented by TCarbonScrollingWinControl.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: Trenatos on April 19, 2016, 02:58:04 pm
That's pretty much what I figured, but I've no idea how to fix it.

My skills in Object Pascal are not good enough yet to contribute bugfixes, but I'll get there.

Any idea of the time/effort involved in fixing the issue?  I'm happy to offer a bit of money for a bugfix (Within reason  :P), since it's the last piece I need to release an open source software I've been working on.
Title: Re: RichMemo scrollbars and wordwrap on OSX
Post by: skalogryz on April 20, 2016, 05:45:24 am
...sigh...
here's a workaround (spent 2+ hours polishing it). It's a workaround, because it actually implements what you might need (non-wordwrapped RichMemo with horizontal scroll) by using external component TScrollBox and TRichMemo itself. (The proper fix should do it within CarbonRichMemo itself)

The workaround is using OSX specific APIs to extract necessary layout information. Thus if you're to use it in your cross-platform project, you'll have to use $ifdefs.

The workaround also recommends to use r4623 of RichMemo. The revision implements OnSelectionChange event support.

You might also notice that RichMemo is yellow and ScrollBox is green in the workaround project. The colors are set via object inspector and could be reset to default colors, if needed.

P.S. speaking of monetary rewards. You could donate some dollars to the community. The link is on the left side of this forum.
TinyPortal © 2005-2018