Recent

Author Topic: OnSelectCell acting strangely  (Read 3220 times)

benwrcoder

  • New member
  • *
  • Posts: 7
OnSelectCell acting strangely
« on: January 25, 2016, 01:06:38 pm »
OnSelectCell triggering every time I move my mouse over a string. I assume its not meant to do that, because it only clicks once. Anyone know why this might be?
Code: Pascal  [Select][+][-]
  1. procedure TViewform.ShowGridSelectCell(Sender: TObject; aCol, aRow: Integer;
  2.   var CanSelect: Boolean);
  3.  
  4. begin
  5.   showmessage(IntToStr(aRow));
  6.   if aRow>0 then
  7.   begin
  8.     Viewform.IDlabel.Caption := IntToStr(mainlist[aRow-1].GetID);
  9.     Viewform.NameLabel.Caption:= mainlist[aRow-1].GetName;
  10.     Viewform.BreedLabel.Caption:= mainlist[aRow-1].GetBreed;
  11.     Viewform.SpeciesLabel.Caption:= mainlist[aRow-1].GetSpecies;
  12.     Viewform.ColorLabel.Caption:= mainlist[aRow-1].GetColor;
  13.     Viewform.HatchLabel.Caption:= mainlist[aRow-1].GetHatch;
  14.   end;
  15.            

Blaazen

  • Hero Member
  • *****
  • Posts: 3239
  • POKE 54296,15
    • Eye-Candy Controls
Re: OnSelectCell acting strangely
« Reply #1 on: January 25, 2016, 01:21:07 pm »
I did a quick test and I observed this: when I push and hold left-mouse button and I hover the grid, it triggers OnSelectCell on each move (even if I am over the same cell). I suspected option RangeSelect but changing it had no effect.
It should be reported.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: OnSelectCell acting strangely
« Reply #2 on: February 12, 2016, 09:21:15 am »
Before submitting a bug report, please check the grid's reference page on Grid's cell selection (http://wiki.lazarus.freepascal.org/Grids_Reference_Page)

Swirl

  • New Member
  • *
  • Posts: 24
Re: OnSelectCell acting strangely
« Reply #3 on: March 28, 2016, 10:43:24 am »
Hi,

I had the same problem when I used one cell (marked with an »X«) to delete a row.
To workaround this Problem I »set the focus« (not really SetFocus) to another row
when the row in question was deleted.
E.g. to ensure that I click on the X-column (Column2) I performed a...
=> if aCol <> 2 then exit;
When I hit Col 2 a little routine deletes the row in question. To avoid that »on-
scroll-seems-to-click-on-same-cell (column) I performed a...
=> SomeGrid.Col := 0; (Col 0 is not affected by clicking or scrolling.

Regards
Working with Lazarus 2.0.12 - FPC 3.2.0 on Win/Mint/elementaryOS
Playing with Lazarus on macOS 10.15 / Catalina

 

TinyPortal © 2005-2018