Recent

Author Topic: Drawing glitch with TStringGrid  (Read 3569 times)

Henppy

  • Jr. Member
  • **
  • Posts: 60
Drawing glitch with TStringGrid
« on: January 03, 2014, 10:27:49 pm »
Hi all.

First of all, sorry if this has been asked before, I just couldn't come up with a good search term for this problem.

I'm having this "glitch" with a TStringGrid component. There's this grid on a form. There is no code right now, no custom draw or anything, just dropped the thing there and changed the fixed row/col count and columns. (please see attachment).

But the last row gets this "line" from the control below and the color from the background (a synedit component with dark gray color) in the parent form.

Any ideas what's happening?

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1251
Re: Drawing glitch with TStringGrid
« Reply #1 on: January 04, 2014, 12:37:56 am »
Wierdliness.  What version of Lazarus/FPC are you using?    And any chance you can post the .pas file and .lfm file?
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Henppy

  • Jr. Member
  • **
  • Posts: 60
Re: Drawing glitch with TStringGrid
« Reply #2 on: January 04, 2014, 01:29:55 am »
Sorry, I forgot post that info... again.

This is Lazarus 1.0.14 with FPC 2.6.2. 64 bits.

I tried compiling in Win7 64 bits, WinXP 32 (VM) and Linux Mint (Cinnamon) 64 bits (VM). It looks fine in Linux, but bad on Windows.

Hmmm... Strage, I didn't notice it before because of the colors, but it happens in the IDE too, sometimes when I press F12 to bring the form up, that last row will show parts of what is underneath.

Here's the code if you want to take a look at it: https://dl.dropboxusercontent.com/u/70266302/sat28.zip That particular form is in the uCodeTemplates unit.

BTW, calling repaint doesn't fix the problem.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1251
Re: Drawing glitch with TStringGrid
« Reply #3 on: January 04, 2014, 01:47:38 am »
The fact that the drawing issue occurs in the IDE confirms it's a StringList StringGrid bug.  Happens on my system too.  also Win 7 Win 8, 64its.  SVN Laz.

I'm looking at your code now, see if I can identify which property is the culprit, after that I'll check on MantraMantis, see if it's a known or not...

UPDATE:  Definitely a drawing issue.  The affected region is one scrollbar high.  If I turn scrollbars off, or increase the width of the control by the width of a vertical scrollbar, then the issue goes away.  Appears to have something to do with the widths of your columns being very close to the width of the control.  Worth noting that at no time did I run the code, simply made changes in the IDE, closed the form, then reopened it.

Nothing comes up on a Bugtracker search of "TStringlist paint".    Looks like a bug report should be raised.

UPDATE2:  In terms of a short term fix to your problem, try On FormShow, set the StringList StringGrid width to 500, then back to 448.   A hack, but works on my system.   Not thoroughly tested :-)

UPDATE 3:  Sigh.  Nothing relevant appears to come up on a more relevant bugtracker search of "TStringGrid Paint" either
« Last Edit: January 04, 2014, 02:39:25 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1251
Re: Drawing glitch with TStringGrid
« Reply #4 on: January 04, 2014, 02:36:47 am »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Henppy

  • Jr. Member
  • **
  • Posts: 60
Re: Drawing glitch with TStringGrid
« Reply #5 on: January 04, 2014, 03:37:57 am »
So it looks like a real bug?

Much appreciated, Mike.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1251
Re: Drawing glitch with TStringGrid
« Reply #6 on: February 06, 2014, 09:00:13 am »
If you have a look on the bug report, you'll see that this issue has been solved (and was in fact solved quite quickly, the delay in reporting here was due to me and other commitments).  No idea which release of Laz will see the fix.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

 

TinyPortal © 2005-2018