View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021987LazarusLCLpublic2012-05-08 18:012012-06-01 08:41
ReporterIhor Lavrynyuk 
Assigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx64OSWindows 7OS VersionUltimate SP1 V5
Product Version1.1 (SVN)Product Build37219 
Target VersionFixed in Version1.1 (SVN) 
Summary0021987: StringGrid DrawCell aCol draws previous columns item
Descriptionhttp://www.youtube.com/watch?v=nlNunJZ6ZS8 [^]

draws previous columns item...

procedure TfrmMain.StringGridGroupsDrawCell(Sender: TObject; aCol,
  aRow: Integer; aRect: TRect; aState: TGridDrawState);
var
bmp: TBitmap;
begin
  //if ((aCol=1) AND (aRow > 0)) then begin // AND (aRow > 0))
  if (StringGridGroups.Columns.Items[aCol].Title.Caption='id') then begin
    bmp := TBitmap.Create;
    FrmMain.ImageList2.GetBitmap(0,bmp);
    StringGridGroups.Canvas.Draw(aRect.Left,aRect.Top,bmp);
    bmp.Free;
  end;
end;
TagsNo tags attached.
Fixed in Revision37296
LazTarget-
WidgetsetWin32/Win64
Attached Fileszip file icon issue.zip [^] (68,995 bytes) 2012-05-08 18:01

- Relationships

-  Notes
(0059407)
Ihor Lavrynyuk (reporter)
2012-05-08 18:08
edited on: 2012-05-08 18:08

and maybe need add StringGridGroups.Columns.Items[aCol].Name

because if (title='Найменування') in source editor -> its not good style =)

if(StringGridGroups.Columns.Items[aCol].Title.Caption='Найменування')

(0059657)
Jesus Reyes (developer)
2012-05-16 23:18

I have fixed the problem of Sorted Column indicator.

The problem drawing on previous column is not a bug, when you are using Custom Columns, grid.Columns.Count<>grid.ColCount, OnDrawCell draws both custom columns and normal columns.

Check grids reference for property columns for an explantaion: http://wiki.lazarus.freepascal.org/Grids_Reference_Page#property_Columns [^]

To fix the problem in your code, I would do:

// check if we are drawing custom columns zone
if aCol>=grid.FixedCols then begin
  // adjust the column index so we can use grid.columns[x]
  aCOl := aCol - grid.FixedCols;
  // then your code...
end;
(0059692)
Ihor Lavrynyuk (reporter)
2012-05-17 19:48

please recommend me, as I find column by name? but no title and no aCol
title I have 'Найменування'
aCol - can be moved ...
maybe need also property name for TStringGrid.Column ?

    c: TGridColumn;
  begin
    // add a custom column a grid
    c := Grid.Columns.Add;
    c.title.name := 'title';
    // modify
    c.title.caption := 'Найменування'; // Set columns caption
    c.align := taRightJustify; // Align column content to the right
    c.color := clMoneyGreen; // Changes default color to clMoneyGreen
    c.Index := 0; // Make it the first column
    // access an existing column
    grid.columns[0].Width := 60; // Change column 0 width to 60 pixels
    // delete an existing column
    grid.columns.delete(0); // Delete column 0
    ....
  end;

- Issue History
Date Modified Username Field Change
2012-05-08 18:01 Ihor Lavrynyuk New Issue
2012-05-08 18:01 Ihor Lavrynyuk File Added: issue.zip
2012-05-08 18:01 Ihor Lavrynyuk Widgetset => Win32/Win64
2012-05-08 18:08 Ihor Lavrynyuk Note Added: 0059407
2012-05-08 18:08 Ihor Lavrynyuk Note Edited: 0059407
2012-05-09 05:41 Jesus Reyes Status new => assigned
2012-05-09 05:41 Jesus Reyes Assigned To => Jesus Reyes
2012-05-16 23:18 Jesus Reyes Fixed in Revision => 37296
2012-05-16 23:18 Jesus Reyes LazTarget => -
2012-05-16 23:18 Jesus Reyes Status assigned => resolved
2012-05-16 23:18 Jesus Reyes Fixed in Version => 1.1 (SVN)
2012-05-16 23:18 Jesus Reyes Resolution open => fixed
2012-05-16 23:18 Jesus Reyes Note Added: 0059657
2012-05-17 19:48 Ihor Lavrynyuk Note Added: 0059692
2012-06-01 08:41 Ihor Lavrynyuk Status resolved => closed



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker