Recent

Author Topic: TMemo on Carbon and GTK2, sLineBreak treatment problem.  (Read 9115 times)

cobata

  • New Member
  • *
  • Posts: 49
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
TMemo on Carbon and GTK2, sLineBreak treatment problem.
« on: November 22, 2016, 06:29:11 pm »
Cheers Colleagues,

Congratulations for your really nice work for the Lazarus IDE and FPC.

The version of Lazarus is 1.4.4.
Text with line breaks is saved and loaded by TMemo (SaveToFile and LoadFromFile). sLineBreak is used.
TMemo in win32/64 widgetset loads from file text with Windows (#13#10) xor Darwin (OS X, El Capitan) (#10) style line breaks correctly.
But TMemo in Carbon loads the text saved to file on Windows by adding a space at the end of each line (represented in the TMemo control, in the debugger it is #10#10). After removing all those spaces the text treatment is correct. It is some kind of workaround.
TMemo in GTK2 on Darwin from Windows and on Windows from Darwin Carbon does not treat the text correctly, because the line break style is kept unchanged (the expected behavior is that with the win32/64 widgetset).

Another one observation with the Carbon interface is regarding the Form scrollbars:
they are always visible when AutoScroll = true. The problem is with just the horizontal scrollbar, because it cоvers the most of the bottom aligned panel and to can see 22 px in height from the panel, you have to set its total height to be 55 px - this is not the case with the vertical scrollbar and the right aligned panel where to can see 23 px in width from the panel, it is enough to set its total width to be 38 px. - they both in the case when you have an object out of the form client area.

And a last observation: Lazarus 1.4.4 with FPC 3.0.0 on Windows and win32/64 widgetset may have mem leaks, because the Heaptrc message differs by the message from Lazarus 1.4.4 with FPC 2.6.4.

What is your opinion mainly regarding the TMemo and the sLineBreak treatment?

Best Regards
« Last Edit: November 23, 2016, 10:50:28 am by cobata »
COBATA Software - Research, Development, Testing, Consulting
https://www.COBATA.com/

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: TMemo on Carbon and GTK2, sLineBreak treatment problem.
« Reply #1 on: November 23, 2016, 12:03:12 pm »
I may be a bit off-topic, but why do you still use Lazarus 1.4, although you have upgraded to FPC 3.0?
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

cobata

  • New Member
  • *
  • Posts: 49
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
Re: TMemo on Carbon and GTK2, sLineBreak treatment problem.
« Reply #2 on: November 23, 2016, 12:15:13 pm »
Yes, I upgraded Laz 1.4.4 to FPC 3.0.0 before the official release of Laz 1.6.0, but found:

"And a last observation: Lazarus 1.4.4 with FPC 3.0.0 on Windows and win32/64 widgetset may have mem leaks, because the Heaptrc message differs by the message from Lazarus 1.4.4 with FPC 2.6.4."

I experimented on Win 10 with Laz 1.6.0 and different Widgetsets (but I was not OK with Qt functionality) and stepped back on Laz 1.4.4 - more tested by me for my project release purposes.
COBATA Software - Research, Development, Testing, Consulting
https://www.COBATA.com/

cobata

  • New Member
  • *
  • Posts: 49
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
Re: TMemo on Carbon and GTK2, sLineBreak treatment problem.
« Reply #3 on: November 29, 2016, 03:46:48 pm »
By using:

!.)
ScreenInfo.PixelsPerInchX:=96;
ScreenInfo.PixelsPerInchY:=96;

2.)
StringReplace(Memo.Text,sLineBreak+sLineBreak,sLineBreak,[rfReplaceAll]);

The problems were workarounded.
Done.
COBATA Software - Research, Development, Testing, Consulting
https://www.COBATA.com/

cobata

  • New Member
  • *
  • Posts: 49
  • Programmer-analyst
    • COBATA Software - Research, Development, Testing, Consulting
Re: TMemo on Carbon and GTK2, sLineBreak treatment problem.
« Reply #4 on: December 01, 2016, 09:20:32 pm »
One correction:
The observed "problem" (TMemo on Carbon and GTK2, sLineBreak treatment problem) seems, because of some bug in the unzip-ing tool on Mac OS X, changing the files with the extraction. 2 years ago we found and a problem with an unzip-ing tool and the symbolic links on Windows<->Linux.
We assume that the reported problem is not actually problem related to GUIs.
COBATA Software - Research, Development, Testing, Consulting
https://www.COBATA.com/

 

TinyPortal © 2005-2018