View Issue Details

IDProjectCategoryView StatusLast Update
0032002LazarusLCLpublic2017-06-16 03:54
ReporterJandir Candido da silveira Assigned Towp  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
PlatformwindowsOSwindows 7 
Summary0032002: bug in grids.pas
Descriptionif "gridlinewdth:=1", the problem is not visible, but if for example gridlinewdth:=8 the focus put over cell
Steps To Reproducein components tstringlist and Tdrawgrid
TagsNo tags attached.
Fixed in Revision55334
LazTarget1.8
Widgetset
Attached Files

Activities

Jandir Candido da silveira

2017-06-11 22:42

reporter  

form_stringgrid_demo.7z (599,273 bytes)

Bart Broersma

2017-06-11 22:44

developer   ~0101041

Can someone please move this to Lazarus?

wp

2017-06-12 13:39

developer   ~0101062

Fixed in r55334. Please test and close if ok.

Jandir Candido da silveira

2017-06-13 19:18

reporter   ~0101101

The revision "Revision 55344" don't fix bug. the bug is before procedure
DrawFocusRect; it's possible fix the focus in grids.pas("quick fix"...):

" R.Right:=R.Right-(FGridLineWidth div 2);
      R.Bottom:=R.Bottom-(FGridLineWidth div 2);
          if HorizontalIntersect(R, ClipArea) then
        DrawFocusRect(FCol,FRow, R);"
but if was painted cell other color, it's necessary:

"procedure TStringGrid1.DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);
  begin
  arect.Bottom:=arect.Bottom -gridlinewidth div 2;
 arect.Right:=arect.Right -gridlinewidth div 2;
..."
it's not...

wp

2017-06-13 19:34

developer   ~0101102

Can you post a little project such that I can see the issue remaining?

Jandir Candido da silveira

2017-06-15 04:23

reporter  

Pgrid.7z (795,635 bytes)

Jandir Candido da silveira

2017-06-15 04:49

reporter   ~0101137

this little project didn't need second change.

wp

2017-06-15 09:51

developer   ~0101139

Then I don't understand the issue...

You are talking about the FocusRect? After my patch it is at the inner side of the grid lines - that's the way I think it should be, before the patch it was partly inside and partly outside.

Please post an image where I can see what you are expecting.

Jandir Candido da silveira

2017-06-15 19:34

reporter  

Focus_.jpg (123,923 bytes)   
Focus_.jpg (123,923 bytes)   

Jandir Candido da silveira

2017-06-15 19:46

reporter   ~0101162

Last edited: 2017-06-15 21:27

View 4 revisions

where is your "Patch"? I did download "https://svn.freepascal.org/svn/lazarus/branches/fixes_1_6/lcl/'' .Is it OK?

wp

2017-06-15 20:03

developer   ~0101164

Yes, that's exactly what is corrected.

You must use svn trunk (the correct url is https://svn.freepascal.org/svn/lazarus/trunk), update your local repository and maybe recompile the IDE.

Since you are asking I think you are not familiar with that? In this case you can patch your Lazarus directly because it is not a large change:

- Go to folder lazarus/lcl and make a backup copy of grids.pas.
- Open grids.pas and find procedure TCustomGrod.CalcFocusRect
- Replace it by this code:

procedure TCustomGrid.CalcFocusRect(var ARect: TRect; adjust: boolean = true);
begin
  if goRowSelect in Options then begin

    if UseRightToLeftAlignment then begin
      aRect.Left := GCache.ClientWidth - GCache.MaxClientXY.x;
      aRect.Right := GCache.ClientWidth - GCache.FixedWidth;
    end else begin
      aRect.Left := GCache.FixedWidth;
      aRect.Right := GCache.MaxClientXY.x;
    end;

    FlipRect(aRect);
  end;

  if not adjust then
    exit;

  if goHorzLine in Options then
    dec(aRect.Bottom, 1 + FGridLineWidth div 2);

  if goVertLine in Options then
    if UseRightToLeftAlignment then
      inc(aRect.Left, 1 + FGridLineWidth div 2)
    else
      dec(aRect.Right, 1 + FGridLineWidth div 2);
end;

Then recompile your project - this should automatically recompile the grids unit. Just in case that the focus rect still is not correct you should rebuild the IDE: Open menu "Tools" / "Configure build Lazarus", in the box "Clean-up" check "Clean all" and "Switch after building to automatically". Then click "Build" and have a cup of coffee. When the new IDE is ready Lazarus restarts and you can test your project again.

Jandir Candido da silveira

2017-06-16 00:02

reporter   ~0101173

fantastic!

Jandir Candido da silveira

2017-06-16 00:09

reporter   ~0101174

it's resolved.
Thank you.

wp

2017-06-16 00:25

developer   ~0101177

Please close.

Issue History

Date Modified Username Field Change
2017-06-11 22:42 Jandir Candido da silveira New Issue
2017-06-11 22:42 Jandir Candido da silveira File Added: form_stringgrid_demo.7z
2017-06-11 22:44 Bart Broersma Note Added: 0101041
2017-06-11 22:50 Jonas Maebe Project FPC => Lazarus
2017-06-12 13:35 wp LazTarget => -
2017-06-12 13:35 wp Assigned To => wp
2017-06-12 13:35 wp Status new => acknowledged
2017-06-12 13:39 wp Fixed in Revision => 55334
2017-06-12 13:39 wp LazTarget - => 1.8
2017-06-12 13:39 wp Note Added: 0101062
2017-06-12 13:39 wp Status acknowledged => resolved
2017-06-12 13:39 wp Resolution open => fixed
2017-06-12 13:39 wp Target Version => 1.8RC2
2017-06-13 19:18 Jandir Candido da silveira Note Added: 0101101
2017-06-13 19:18 Jandir Candido da silveira Status resolved => assigned
2017-06-13 19:18 Jandir Candido da silveira Resolution fixed => reopened
2017-06-13 19:34 wp Note Added: 0101102
2017-06-13 19:34 wp Status assigned => feedback
2017-06-15 04:23 Jandir Candido da silveira File Added: Pgrid.7z
2017-06-15 04:49 Jandir Candido da silveira Note Added: 0101137
2017-06-15 04:49 Jandir Candido da silveira Status feedback => assigned
2017-06-15 09:51 wp LazTarget 1.8 => -
2017-06-15 09:51 wp Note Added: 0101139
2017-06-15 09:51 wp Status assigned => feedback
2017-06-15 09:51 wp Target Version 1.8RC2 =>
2017-06-15 19:34 Jandir Candido da silveira File Added: Focus_.jpg
2017-06-15 19:46 Jandir Candido da silveira Note Added: 0101162
2017-06-15 19:46 Jandir Candido da silveira Status feedback => assigned
2017-06-15 19:47 Jandir Candido da silveira Note Edited: 0101162 View Revisions
2017-06-15 19:57 Jandir Candido da silveira Note Edited: 0101162 View Revisions
2017-06-15 20:03 wp Note Added: 0101164
2017-06-15 21:27 Jandir Candido da silveira Note Edited: 0101162 View Revisions
2017-06-16 00:02 Jandir Candido da silveira Note Added: 0101173
2017-06-16 00:09 Jandir Candido da silveira Note Added: 0101174
2017-06-16 00:25 wp LazTarget - => 1.8
2017-06-16 00:25 wp Note Added: 0101177
2017-06-16 00:25 wp Status assigned => resolved
2017-06-16 00:25 wp Resolution reopened => fixed
2017-06-16 03:54 Jandir Candido da silveira Status resolved => closed