View Issue Details

IDProjectCategoryView StatusLast Update
0013139LazarusPatchpublic2009-10-23 00:40
ReporterFunky Beast Assigned ToJesus Reyes  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version0.9.27 (SVN) 
Target Version0.9.28Fixed in Version0.9.27 (SVN) 
Summary0013139: Patch to add FixedCols capability for TCustomGrid and TDBGrid
DescriptionPatch adds FixedCols capability to TCustomDBGrid.

Patch is diffed from root of Lazarus
TagsNo tags attached.
Fixed in Revision20801
LazTarget0.9.28
WidgetsetGTK 2
Attached Files

Activities

2009-02-09 07:57

 

dbgrid_patch.zip (2,687 bytes)

Jesus Reyes

2009-02-14 06:18

developer   ~0025378

It looks the patch was made against a previous Lazarus/fpc version, some things like changing textstyle fields directly are not allowed anymore in recent fpc versions, btw, there are changes that seems have nothing to do with the patch for example setting canvas.textstyle.singleline, forcing scrolling by one record (apparently to handle mousewheel but ignoring scrolling with scrollbar).

Apparently the patch will handle TCustomgrid and dbgrid but most work that would work in both grids is only on dbgrid.

With this patch all fixed cols (except indicator column) in dbgrid need to have a column associated, previouly fixed columns where completly descendant grids customizable (although I don't know of anybody that use this feature to be honest)

Can you please make some comments on the above.

2009-02-14 09:08

 

dbgrid_sample1.png (52,428 bytes)   
dbgrid_sample1.png (52,428 bytes)   

Funky Beast

2009-02-14 09:09

reporter   ~0025382

Last edited: 2009-02-14 12:37

The patch was made against fpc 2.2.3 and the latest Lazarus at that time
the patch was created.

Changes in TCustomGrid alters a few methods to become dynamic so that
TCustomDBGrid can override them for calculating fixed and non fixed column
fields. FixedCols should be set after all columns are created.

Yes, this patch is about having fixed columns capabilities that is absent in
TCustomDBGrid. TCustomGrid was modified abit to facilitate that.

As for scrolling one record at a time, that was a behavior that was in Kylix.
Each mouse-wheel event scrolls one record. But LCL's grid seems to combine
mouse-wheel and scrollbar events together. Mouse-wheel events were not fired
when mouse is scrolled on the grid, instead scrollbar events are fired. That
is why I had modified the scrollbar events. I've tested and the scrollbar
did work.

The textstyle.singleline is for multiline titles.

I've attached a screenshot of what I tried and have achieved.

Jesus Reyes

2009-02-21 07:39

developer   ~0025609

Please clean the patch of unrelated things like scrolling (you can submit an additional patch for that if you want) and modifying canvas.textstyle behaviour. At the begining multiline text was default but it was not very popular, that's why we have OnPrepareCanvas or DefaultTextStyle so users that need multiline can enable it.

One last petition, please update and test the patch agaist current svn lazarus revision.

2009-02-22 13:21

 

dbgrid_patch2.zip (2,405 bytes)

Funky Beast

2009-02-22 13:27

reporter   ~0025628

Last edited: 2009-02-22 13:37

Jesus,

As requested, attached "dbgrid_patch2.zip" is a cleaned up patch that only
concerns about fixed columns for TCustomDBGrid.

Patch is diffed against latest lazarus svn r18791 using
fpc 2.2.3 r12768.

TextStyle modifications were all removed, thanks to you, I now understand
the purpose of DefaultTextStyle.

Scrolling one record per mouse-wheel event is also removed from this patch,
but will be submitted as a seperate issue latter when this patch is applied.

I need an opinion about wheather this scrolling behaviour should be optional
or not. If so, I will add a property for triggering this behaviour.

Vincent Snijders

2009-02-22 14:47

manager   ~0025629

IMHO, it should scroll Mouse.WheelScrollLines records per mousewheel event.

if WheelScrollLines < 0 it should scroll a page.

Funky Beast

2009-02-22 16:21

reporter   ~0025631

Last edited: 2009-02-22 16:42

I find that WheelScrollLines are better applied to text browsing/editing
controls, or container controls. But for TDBGrid, I find it not as essential.

Kylix's DBGrid scrolls one record per mousewheel event, which facilitates
good accessibilities in some situations. For example, I have an app written
using Kylix that has a DBGrid that shows some information for engineering
models. Below it is a panel that displays the mechanical engineering drawing
related to the current record. Kylix's mousewheel behaviour allows me to use
the mouse to scroll the DBGrid notch by notch to browse through each drawing
one record at a time. Hence thats the reason I forced it to one record
scrolling in the first place.

Maybe this property should be an integer for setting records per wheel-scroll.
Then a function can be written for setting it to WheelScrollLines value, for
anyone who wants it to respect that system setting. Or even call this function
from the constructor of TCustomDBGrid so that default value is set to
WheelScrollLines. Descendents can override this property to suit their needs.

Jesus Reyes

2009-07-06 20:50

developer   ~0028949

Applied with changes.

Thanks.

About amount of scroll lines when using mousewheel, the grid tries to enforce movements of record by record (see dbgrid.domousewheeldown and dbgrid.domousewheelup, but under some widgets mousewheel is handled before dbgrid can take action, I think this should be fixed so it scrolls only one record, please submit additional bug report.

Issue History

Date Modified Username Field Change
2009-02-09 07:57 Funky Beast New Issue
2009-02-09 07:57 Funky Beast File Added: dbgrid_patch.zip
2009-02-09 07:57 Funky Beast Widgetset => GTK 2
2009-02-09 08:28 Paul Ishenin LazTarget => 0.9.28
2009-02-09 08:28 Paul Ishenin Assigned To => Jesus Reyes
2009-02-09 08:28 Paul Ishenin Status new => assigned
2009-02-09 08:28 Paul Ishenin Target Version => 0.9.28
2009-02-14 06:18 Jesus Reyes Note Added: 0025378
2009-02-14 06:18 Jesus Reyes Status assigned => feedback
2009-02-14 09:08 Funky Beast File Added: dbgrid_sample1.png
2009-02-14 09:09 Funky Beast Note Added: 0025382
2009-02-14 12:37 Funky Beast Note Edited: 0025382
2009-02-21 07:39 Jesus Reyes Note Added: 0025609
2009-02-22 13:21 Funky Beast File Added: dbgrid_patch2.zip
2009-02-22 13:27 Funky Beast Note Added: 0025628
2009-02-22 13:37 Funky Beast Note Edited: 0025628
2009-02-22 14:47 Vincent Snijders Note Added: 0025629
2009-02-22 16:21 Funky Beast Note Added: 0025631
2009-02-22 16:42 Funky Beast Note Edited: 0025631
2009-04-16 22:01 Vincent Snijders Status feedback => assigned
2009-07-06 20:50 Jesus Reyes Fixed in Revision => 20801
2009-07-06 20:50 Jesus Reyes Status assigned => resolved
2009-07-06 20:50 Jesus Reyes Fixed in Version => 0.9.27 (SVN)
2009-07-06 20:50 Jesus Reyes Resolution open => fixed
2009-07-06 20:50 Jesus Reyes Note Added: 0028949
2009-10-23 00:40 Marc Weustink Status resolved => closed