* * *

Author Topic: Column indicator draw  (Read 1338 times)

J-23

  • New member
  • *
  • Posts: 29
Column indicator draw
« on: January 28, 2018, 04:03:39 am »
Hello,
I found the code that is responsible for drawing the 'indicator' in Grid but it needs to get to the code of the column on which the 'indicator' is drawn

Where to look for it?

Regards

ASerge

  • Hero Member
  • *****
  • Posts: 862
Re: Column indicator draw
« Reply #1 on: January 28, 2018, 02:01:02 pm »
I found the code that is responsible for drawing the 'indicator' in Grid but it needs to get to the code of the column on which the 'indicator' is drawn
What is an 'indicator'? Do you want the position of the slider or its size and coordinates in pixels?

jamie

  • Hero Member
  • *****
  • Posts: 786
Re: Column indicator draw
« Reply #2 on: January 28, 2018, 04:17:11 pm »
I think he is looking to see how the grid lines are drawn on the screen, partitioned etc..

The TDrawGrid would be a good start.

GetMem

  • Hero Member
  • *****
  • Posts: 3109
Re: Column indicator draw
« Reply #3 on: January 28, 2018, 04:25:04 pm »
The indicator is the small triangle in front of the focused row. Still I'm not sure if I' understood the question. It is drawn to the first fixed column.

jamie

  • Hero Member
  • *****
  • Posts: 786
Re: Column indicator draw
« Reply #4 on: January 28, 2018, 04:37:37 pm »
yeah, that looks logical..

 I don't think that is part of the grid itself, it is something that needs to be drawn during the
OnDrawCell or override the DoDrawCell etc..

Or you can use a TArray as a control on the left column located in Misc tab

J-23

  • New member
  • *
  • Posts: 29
Re: Column indicator draw
« Reply #5 on: January 28, 2018, 05:33:07 pm »
The indicator is the small triangle in front of the focused row. Still I'm not sure if I' understood the question. It is drawn to the first fixed column.

yes, it is about the "narrow space" on which the indicator is drawn. How to manipulate this space - where is it defined in Grid?

GetMem

  • Hero Member
  • *****
  • Posts: 3109
Re: Column indicator draw
« Reply #6 on: January 28, 2018, 05:42:52 pm »
Quote
yes, it is about the "narrow space" on which the indicator is drawn. How to manipulate this space - where is it defined in Grid?
You should subclass TDBGrid or write a class helper, but if you're lazy just copy DBGrid.pas from $(LazarusDir)\lcl folder to your project directory and change the line(see screenshot), or do whatever modifications are necessary.

wp

  • Hero Member
  • *****
  • Posts: 4830
Re: Column indicator draw
« Reply #7 on: January 28, 2018, 05:45:59 pm »
If you are talking of the DBGrid, the indicator is drawn by TCustomDBGrid.DrawIndicators in DBGrids. The rectangle available for painting is passed as parameter R. It is called from TCustomDBGrid.DrawFixedText which in turn is called from TCustomDrawGrid.DefaultDrawCell if the DrawingState includes the flag gdFixed. DefaultDrawCell is called (via DrawCell) from TCustomGrid.DrawRow which is called from TCustomGrid.DrawAllRows.

So the entire calling sequence is
TCustomGrid.Paint --> TCustomGrid.DrawAllRows --> TCustomGrid.DrawRow --> TCustomDBGrid.DrawCell --> TCustomDBGrid.DefaultDrawCell --> TCustomDBGrid.DrawFixedText --> TCustomDBGrid.DrawIndicators.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

J-23

  • New member
  • *
  • Posts: 29
Re: Column indicator draw
« Reply #8 on: January 28, 2018, 09:19:50 pm »
Quote
yes, it is about the "narrow space" on which the indicator is drawn. How to manipulate this space - where is it defined in Grid?
You should subclass TDBGrid or write a class helper, but if you're lazy just copy DBGrid.pas from $(LazarusDir)\lcl folder to your project directory and change the line(see screenshot), or do whatever modifications are necessary.

That's exactly what I meant. Thank you :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus