View Issue Details

IDProjectCategoryView StatusLast Update
0019458LazarusWidgetsetpublic2011-06-08 13:58
ReporterFrederickAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.30Product Build 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0019458: DrawGrid.Selection does not update active cell
DescriptionSetting DrawGrid.Selection does not change the active cell used by the keyboard. Example file attached. Run and do the folloewing, note (R1 C1) means (Row 1, Col 1):

Bug 1:
Use mouse or keyboard to select cell (R3 C3)
OnSelection reports (R3 C3)
Press button 'Select 1x1', which sets DrawGrid.Selection = (R1 C1)
OnSelection does not report change
Press 'Get Selection', which correctly reports (R1 C1)
Press down arrow on keyboard, moves selection to (R4 C3) instead of (R2 C1)

Bug 2:
Now press 'Deselect', which sets DrawGrid.Selection = (-1,-1,-1,-1)
Nothing happens
Press 'Get Selection', which still reports (R4 C3)
Press down arrow on keyboard, moves selection to (R5 C3) instead of (R1 C1)


lazarus-0.9.30-i386-macosx
OS X 10.6.7
Carbon
TagsNo tags attached.
Fixed in Revision31008
LazTarget0.99.0
WidgetsetCarbon
Attached Files

Activities

2011-06-01 17:26

 

DrawGrid_Selection.zip (5,372 bytes)

Frederick

2011-06-01 17:33

reporter   ~0048740

I did a clean install of 0.9.30 because of problems I was having after installing snapshots.

Frederick

2011-06-01 17:44

reporter   ~0048741

Last edited: 2011-06-01 17:46

Bug 3:
Select (R4 C4)
Press 'Select 3x3', nine cells are selected
Press 'Deselect', all are deselected
Press 'Select 1x1', one cell is selected
Press 'Deselect', nothing happens
Note also that the focused cell remains (R4 C4)

Jesus Reyes

2011-06-02 08:46

developer   ~0048745

In fact grid.selection behaves somewhat independent of cell cursor and this is used in at least one of my apps, so in this case the reported bugs are really features, in r31008 I added an option: goSelectionActive meaning that by using grid.Selection will also activate/move cell cursor which should be more in concordance with ..., well you didn't specify how should it behave but I took the bug's descriptions as some kind of specification. Please test.

Frederick

2011-06-02 16:49

reporter   ~0048755

Last edited: 2011-06-02 16:58

Thank you Jesus! I understand the behavior now. I was clearly confusing the relationship between the cursor and the selection, and was banging my head on the wall.

One small discrepancy is that:

DrawGrid1.Selection := TGridRect(Rect(1, 1, 1, 1));
DrawGrid1.Selection := TGridRect(Rect(-1, -1, -1, -1));

does not deselect, while

DrawGrid1.Selection := TGridRect(Rect(1, 1, 2, 1));
DrawGrid1.Selection := TGridRect(Rect(-1, -1, -1, -1));

does.

Unfortunately, I am having no luck with svn, so am still using 0.9.30 and can't yet try out the cool new option (thanks!). I deleted lazarus settings, ran 'svn co' in clean lazarus directory, got r31010 ok, did 'make clean all', and rebuilt. I kept getting errors:

'A timeout occurred..."
'Error Project project1.app raised exception 'RunError(201)''
'project1 quit unexpectedly...'
'Debugger error...'

so had to go back to 0.9.30. I got a bit frustrated, so will try again later. Many thanks for your work on this.

By the way, the reason that I was working with TDrawGrid was because the current application I'm working on requires non-contiguous row selections. I ended up storing the state in my data structure, and painting rows using OnPrepareCanvas and OnDrawCell. Am a correct that TDrawGrid does not support non-contiguous cell selection?

Cheers,
Frederick

Frederick

2011-06-02 23:48

reporter   ~0048761

Setting Row = -1, Col = -1 seems to have no effect. Is it possible to set the focus off?

Frederick

2011-06-08 13:58

reporter   ~0048959

Thanks Jesus

Issue History

Date Modified Username Field Change
2011-06-01 17:26 Frederick New Issue
2011-06-01 17:26 Frederick File Added: DrawGrid_Selection.zip
2011-06-01 17:26 Frederick Widgetset => Carbon
2011-06-01 17:33 Frederick Note Added: 0048740
2011-06-01 17:44 Frederick Note Added: 0048741
2011-06-01 17:46 Frederick Note Edited: 0048741
2011-06-01 17:46 Frederick Note Edited: 0048741
2011-06-02 08:10 Jesus Reyes Status new => assigned
2011-06-02 08:10 Jesus Reyes Assigned To => Jesus Reyes
2011-06-02 08:46 Jesus Reyes Fixed in Revision => 31008
2011-06-02 08:46 Jesus Reyes LazTarget => 0.99.0
2011-06-02 08:46 Jesus Reyes Status assigned => resolved
2011-06-02 08:46 Jesus Reyes Fixed in Version => 0.9.31 (SVN)
2011-06-02 08:46 Jesus Reyes Resolution open => fixed
2011-06-02 08:46 Jesus Reyes Note Added: 0048745
2011-06-02 08:47 Jesus Reyes Target Version => 0.99.0
2011-06-02 16:49 Frederick Note Added: 0048755
2011-06-02 16:50 Frederick Note Edited: 0048755
2011-06-02 16:58 Frederick Note Edited: 0048755
2011-06-02 23:48 Frederick Note Added: 0048761
2011-06-08 13:58 Frederick Status resolved => closed
2011-06-08 13:58 Frederick Note Added: 0048959