Recent

Author Topic: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac  (Read 2917 times)

emhartner

  • Jr. Member
  • **
  • Posts: 54
I'm experiencing strange behavior when putting data in my TDBGrid in my Cocoa application that uses a SQLite database.  When I put data into the first field, it puts text "WMTigq[_|^" into the other fields when I tab out of the first field.  I find this "WMTigq[_|^" text in lazarus/lcl/interfaces/cocoa/cocoagdiobjects.pas.  Note that this happens with both the latest trunk version and the current stable release downloaded from the following site:
https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20x86-64/Lazarus%202.0.12/

A few things to note:
- As stated above, this happens with the most recent trunk version of Lazarus as well as the current stable version.
- I have no issues at all when the same code is compiled for Windows under the current stable version.

Any ideas what would cause this to be triggered on Mac?

Thank you,
Eric
« Last Edit: April 03, 2021, 06:45:46 pm by emhartner »

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: WMTigq[_|^ Being Written In Other SQLite TBGrid Fields On Mac
« Reply #1 on: April 03, 2021, 06:19:01 pm »
I'm experiencing strange behavior when putting data in my TDBGrid in my Cocoa application that uses a SQLite database.  When I put data into the first field, it puts text "WMTigq[_|^" into the other fields when I tab out of the first field.  I find this "WMTigq[_|^" text in lazarus/lcl/interfaces/cocoa/cocoagdiobjects.pas.  Note that this happens with both the latest trunk version and the current stable release downloaded from the following site:
https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20x86-64/Lazarus%202.0.12/

A few things to note:
- As stated above, this happens with the most recent trunk version of Lazarus as well as the current stable version.
- I have no issues at all when the same code is compiled for Windows under the current stable version.

Any ideas what would cause this to be triggered on Mac?

Thank you,
Eric

SynTextDrawer and CoocaGDIObjects use this value to measure text height. It is somehow getting stored back to the control value. Can't say how.

[EDIT]

TCocoaContext.GetTextMetrics is assigning it to the Text member.
« Last Edit: April 03, 2021, 06:25:43 pm by dsiders »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #2 on: April 04, 2021, 03:59:37 pm »
Quote
TCocoaContext.GetTextMetrics is assigning it to the Text member.

So it's normal that GetTextMetrics is being called - just not that it's leaving this text in back in the grid cell - right?

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #3 on: April 04, 2021, 05:53:53 pm »
Quote
TCocoaContext.GetTextMetrics is assigning it to the Text member.

So it's normal that GetTextMetrics is being called - just not that it's leaving this text in back in the grid cell - right?

Sure, The edit needs to know how tall or wide it needs to be. Other widgetsets return the value as a result and don't store the text they use to measure it. Maybe this is a Cocoa thing. I don't know the solution. I just pointed out the two places where that text occurs in LCL. I don't have any Mac hardware, and even if I did, I couldn't "think different" enough to use it.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #4 on: April 05, 2021, 01:08:18 pm »
Thank you dsiders.  Hopefully someone who programs Lazarus on a Mac will see this and point me in the right direction.  Meanwhile, I'll keep plugging away.

Bart

  • Hero Member
  • *****
  • Posts: 5288
    • Bart en Mariska's Webstek
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #5 on: April 05, 2021, 02:45:28 pm »
Please file a bugreport in the bugtracker, otherwise it will most likely not get fixed.
Make sure to specify category as "Widgetset".

Bart

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #6 on: April 06, 2021, 03:31:06 am »
Ok, so the described problem seems to only occur when I set the TStringField.Size to a very large number such as 2000.  With previous versions of Lazarus, I had the Size set to 2000 with no issues at all.  It seems now that if the Size exceeds 255, I start having unexpected behaviors on Mac.  On Windows this does not seem to be an issue.

Is this size limitation something imposed on purpose?
« Last Edit: April 06, 2021, 01:42:13 pm by emhartner »

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #7 on: April 07, 2021, 04:44:20 pm »
So the problem is definitely related to the TStringField.Size.  Strange things start to happen when Size exceeds 255, but you don't see the "WMTigq[_|^" text from TCocoaContext.GetTextMetrics showing up until the Size is much higher.  And just to re-iterate, I do NOT see this problem when compiled and linked for Windows.

I'll go ahead and enter in a bug report under the Cocoa Widgetset.

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #8 on: April 07, 2021, 05:02:21 pm »
Quote
I'll go ahead and enter in a bug report under the Cocoa Widgetset.

Here's a link to the bug report:
https://bugs.freepascal.org/view.php?id=38714

emhartner

  • Jr. Member
  • **
  • Posts: 54
Re: WMTigq[_|^ Being Written In Other SQLite TDBGrid Fields On Mac
« Reply #9 on: April 08, 2021, 05:17:52 am »
Quote
I'll go ahead and enter in a bug report under the Cocoa Widgetset.


Here's a link to the bug report:
https://bugs.freepascal.org/view.php?id=38714

Another piece of information added to the bug report:

Note that the problem seems to occur when I do not include a field length in the for the WideChar fields when creating the table.  For example...

I have the issue when working with the table created by the following:
create table test1 (field1 WideChar, field2 WideChar, field3 WideChar)

However, I don't have the issue when working with the table created by the following:
create table test1 (field1 WideChar(8000), field2 WideChar(8000), field3 WideChar(8000))

 

TinyPortal © 2005-2018