Recent

Author Topic: TCDListView properties  (Read 10840 times)

PatBayford

  • Full Member
  • ***
  • Posts: 125
TCDListView properties
« on: November 13, 2017, 01:31:45 am »
A simple question, probably with a complex answer - why does TCDListView NOT have a GridLines property? Is this a "widget" limitation, or due to the inheritance tree?
I like the look of the component, but really need the gridlines.
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: TCDListView properties
« Reply #1 on: November 13, 2017, 04:41:39 am »
To the best of my knowledge CustomDrawn components are widget independent.  I suspect that Gridlines was never implemented.   Feel free to lodge a request in Mantis, preferably with a patch :-)
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

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: TCDListView properties
« Reply #2 on: November 13, 2017, 11:22:57 pm »
Thanks Mike - I do not know enough about the widgets to make that judgement, but guessed it was the case. I'll have a look at the code (Delphi to start) and see if I am able to add the necessary code for a patch.
BTW - where the heck do I find "Mantis"?
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: TCDListView properties
« Reply #3 on: November 13, 2017, 11:27:01 pm »
Quote
BTW - where the heck do I find "Mantis"?

lol  You mean you can't read my mind?  Sorry about that.  Click on the second "Bugtracker" under the Lazarus logo on this very page. <points to top left of this page>  Each "bugtracker" link goes to Mantis, the first for fpc issues, the second for Lazarus issues.
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

Bart

  • Hero Member
  • *****
  • Posts: 5468
    • Bart en Mariska's Webstek
Re: TCDListView properties
« Reply #4 on: November 13, 2017, 11:34:14 pm »
'll have a look at the code (Delphi to start) and see if I am able to add the necessary code for a patch.

PLease do NOT do that (looking at Delphi code to write a patch for Lazarus).
You will taint our codebase.

Bart

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: TCDListView properties
« Reply #5 on: November 14, 2017, 12:18:31 am »
Sorry Bart - not intending to use any of the Delphi codebase, just looking for pointers as to where, and how, to implement the gridline routines.
As it happens, perusal of the CustomDrawn code suggests it may not be possible - I just stumbled across this :-
Code: Pascal  [Select][+][-]
  1. procedure TCDControl.DrawToCanvas(ACanvas: TCanvas);
  2. var
  3.   lSize: TSize;
  4.   lControlId: TCDControlID;
  5. begin
  6.   PrepareCurrentDrawer();
  7.   lSize := Size(Width, Height);
  8.   lControlId := GetControlId();
  9.   PrepareControlState;
  10.   PrepareControlStateEx;
  11.   FDrawer.DrawControl(ACanvas, Point(0, 0), lSize, lControlId, FState, FStateEx);
  12. end;
  13.  
The reference here to lControlId, which will be cidListView, suggests that the drawing behaviour is, indeed, embedded in the Drawer routines of the widgetset. Will have to have a poke about in there to see if the possibility exists to draw the grid lines.
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: TCDListView properties
« Reply #6 on: November 14, 2017, 12:33:29 am »
Quote
The reference here to lControlId, which will be cidListView, suggests that the drawing behaviour is, indeed, embedded in the Drawer routines of the widgetset

I still don't think so (ignoring items like @howardpc's open question here about Pen Style psDash being implemented on GTK2 or not)

Following TCDControlID through, it's just a list of different objects to draw.  For list views, this gets you to procedure TCDDrawerCommon.DrawListView in customdrawn_common.pas.  There you will see only ReportStyle is supported, and the subsequent procedure "DrawReportListView" is just paint on canvas style code.  That'd be where you add support for grid lines :-)
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: 1263
Re: TCDListView properties
« Reply #7 on: November 14, 2017, 12:36:10 am »
When searching through Lazarus and fpc source code "Find in Files" is my goto tool of choice.
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

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: TCDListView properties
« Reply #8 on: November 14, 2017, 01:07:19 am »
Thanks for the hint Mike.Cornflake - I had not got that far through the TCDDrawer code!! Will check it out thoroughly - the point being that there is little point implementing the code if it only going to get overwritten by the existing code - I've made this mistake before!!
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: TCDListView properties
« Reply #9 on: November 14, 2017, 01:19:22 am »
Apologies.  I see now where you're coming from.  I was thinking in terms of producing a Patch for the custom-drawn control, you were thinking in terms of drawing the grid-lines in your own code as if it was owner-drawn.  You are correct, any painting you do in your own project will be overwritten by the custom-drawn control.
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

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: TCDListView properties
« Reply #10 on: November 14, 2017, 02:52:19 am »
If possible I will try and produce a patch for the custom-drawn control. At the moment I can't see if the necessary property to control the drawing is available inside the Drawer routines - it SHOULD be. Some testing will be necessary.
This is complicated by the fact that the control has a Properties property, which contains the relevant information, but this is commented out in the source! I assume this is because some of the items are not implemented, and this avoids lots of compile-time errors.
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

PatBayford

  • Full Member
  • ***
  • Posts: 125
Re: TCDListView properties
« Reply #11 on: November 17, 2017, 11:24:55 pm »
I have had a good look at the CustomDraw units, and there seem to be two ways to proceed, either to fully implement the Properties property, or to patch in a simple property to hold the GridLines state.
It would be nice to have some feedback on which route would be the preferred method, especially as either will require a similar patch to the ControlStateEx property, so that the GridLines state can be passed to the CustomDrawer, which is decoupled from the component.
Lazarus 1.8.0 FPC 3.0.2 SVN 56594 Windows 10 64bit (i386-win32-win32/win64)

 

TinyPortal © 2005-2018