View Issue Details

IDProjectCategoryView StatusLast Update
0020494LazarusLCLpublic2011-10-28 08:34
ReporterSelzig HEMAssigned ToJesus Reyes 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.31 (SVN)Product Build 
Target Version1.2.0Fixed in Version0.9.31 (SVN) 
Summary0020494: StringGrid : MultiSelec and MouseWheel : curious behavior
DescriptionHello,

Before hacking my StringGrid.

I put on my Form a default StringGrid. Option --> goRowSelect := True;

 On any line, I run consecutively these three events:
 1. MouseDown
 2. MouseUp -> line is selected.
 3. MouseWheelDown -> the previous line is deselected and the following lines are selected one by one. That seems normal.

 I repeat the same procedure by selecting a block of several lines
 1. MouseDown
 2. MouseMouve
 3. MouseUp: a block is selected
 4. MouseWheelDown -> block is NOT DESELECTED and the selected block expands with MouseWheelDown.

Is this normal behavior? Why is the MouseUp interrupts the selection in one case and not the other?
In the second case, how do we interrupt the selection ?
Regards. Gilles

Last SVN Lazarus (/trunk) and fpc 2.4.5 : Win 7 and Linux 32 bits
TagsNo tags attached.
Fixed in Revision32947, 33125
LazTarget1.2
Widgetset
Attached Files

Activities

Tomasz Wieckowski

2011-10-16 22:46

reporter   ~0053061

as well as goDrawFocusSelected.
It's a bug. Should be related only with focused cell.

Selzig HEM

2011-10-17 09:40

reporter   ~0053080

Well,

until something better, I use this :

procedure TForm1.StringGrid1MouseWheelDown(Sender: TObject; Shift: TShiftState;
  MousePos: TPoint; var Handled: Boolean);
var
  iLast :integer;
begin
 with StringGrid1 do begin
  if not (goRowSelect in Options) then exit;
  {Détermination de la ligne sélectionnée la plus basse}
  iLast := Row;
  if not (iLast = RowCount -1) then begin
   repeat
    inc(ilast);
   until not IsCellSelected[FixedCols, iLast];
    dec(iLast);
  end else
   iLast := RowCount;
  {Effacement de la sélection actuelle}
  Selection := Rect(-1, -1, -1, -1);
  {Se placer ligne suivante}
  if not( iLast = RowCount) then
   Row := iLast
  else
   Row := RowCount -1;
 end;
end;
 
procedure TForm1.StringGrid1MouseWheelUp(Sender: TObject; Shift: TShiftState;
  MousePos: TPoint; var Handled: Boolean);
var
  iFirst :integer;
begin
 with StringGrid1 do begin
  if not (goRowSelect in Options) then exit;
  {Détermination de la ligne sélectionnée la plus haute}
  iFirst := Row;
  if not (iFirst = FixedRows) then begin
   repeat
    Dec(iFirst);
   until not IsCellSelected[FixedCols, iFirst];
   Inc(iFirst);
  end else
   iFirst := FixedRows;
  {Effacement de la sélection actuelle}
  Selection := Rect(-1, -1, -1, -1);
  {Se placer ligne précédente}
  if not( iFirst = FixedRows) then
   Row := iFirst
  else
   Row := FixedRows;
 end;
end;

Regards. Gilles

Jesus Reyes

2011-10-17 17:15

developer   ~0053099

please tests and close if problem is corrected.

Selzig HEM

2011-10-24 16:24

reporter   ~0053368

Hello,

Sorry, but it works partielly :

If you add

in OnMouseWheelDown

Handled := true; //scrolls the grid, not the selection
 with Sender as TStringGrid do
  if Row < RowCount-1 then Row := Row +1;

or

in OnMouseWheelUp

Handled := true; //scrolls the grid, not the selection
  with Sender as TStringGrid do
   if Row > 1 then Row := Row -1;

the bug always exists

Regards. Gilles

Jesus Reyes

2011-10-28 08:34

developer   ~0053527

Please test.

Issue History

Date Modified Username Field Change
2011-10-16 09:52 Selzig HEM New Issue
2011-10-16 22:46 Tomasz Wieckowski Note Added: 0053061
2011-10-17 08:39 Vincent Snijders LazTarget => 1.2
2011-10-17 08:39 Vincent Snijders Status new => assigned
2011-10-17 08:39 Vincent Snijders Target Version => 1.2.0
2011-10-17 09:40 Selzig HEM Note Added: 0053080
2011-10-17 10:48 Vincent Snijders Assigned To => Jesus Reyes
2011-10-17 17:15 Jesus Reyes Fixed in Revision => 32947
2011-10-17 17:15 Jesus Reyes Status assigned => resolved
2011-10-17 17:15 Jesus Reyes Fixed in Version => 0.9.31 (SVN)
2011-10-17 17:15 Jesus Reyes Resolution open => fixed
2011-10-17 17:15 Jesus Reyes Note Added: 0053099
2011-10-24 16:24 Selzig HEM Status resolved => assigned
2011-10-24 16:24 Selzig HEM Resolution fixed => reopened
2011-10-24 16:24 Selzig HEM Note Added: 0053368
2011-10-28 08:34 Jesus Reyes Fixed in Revision 32947 => 32947, 33125
2011-10-28 08:34 Jesus Reyes Status assigned => resolved
2011-10-28 08:34 Jesus Reyes Resolution reopened => fixed
2011-10-28 08:34 Jesus Reyes Note Added: 0053527