GetTextLen does not work for some controls under Cocoa
Original Reporter info from Mantis: dbannon @davidbannon
-
Reporter name: David
Original Reporter info from Mantis: dbannon @davidbannon
- Reporter name: David
Description:
The GetTextLen method (?) fails for controls that Apple dond't see as NSControl, this includes TMemo, TRichMemo and TListBox.
Attached is a patch that solves the problem for TMemo and TRichMemo (but sadely, not TListBox).
Steps to reproduce:
When using Cocoa, call, for example, RichMemo1.getTextLen or Memo1.GetTextLen. Both will return zero even if there is considerable text in the control.
Additional information:
In RichMemo, the GetTextLen is used quite extensively, it therefore prevents a number of important RichMemo methods working under Cocoa. The issue relates to the fact that not all (Lazarus) Controls are (Apple) NSControls. TMemo, TRichMemo and TListBox are NSScrollView but the existing code, in CocoaWSCommon.pas tests for a control being NSControl and it its not, returns an errror. I have added the ability to return valid data for TMemo and TRichMemo. Thanks to Skalogryz for pointing me in right direction - https://forum.lazarus.freepascal.org/index.php/topic,51596.msg378962.html
Mantis conversion info:
- Mantis ID: 37835
- OS: Sierra
- Platform: MacOS
- Fixed in revision: 64118 (#d1b94111)
- Monitored by: » @davidbannon (David)