Discussion:
Selecting a cell in a StringGrid
jean-marc levecque
2005-11-05 22:02:10 UTC
Permalink
Hi,

SelectCell seam to have a strange behaviour.
After selecting by clicking a cell, if you move again the cursor over the
grid, its selecting the first cell reached by the cursor.
Also, the fixed rows/cols cannot be selected, and cell[0,0] is never selected
even when fixed rows/cols are set to 0.
I checked this with only a StringGrid with ShowMessage in onSelectCellEvent.
As I am not so sure of what should be the good behaviour, I compared to
Delphi, and there, any cell can be selected, no problem with the cursor back
over the grid.
Now, is there any other mean to select a cell, and use it for some action ?
Jesus Reyes
2005-11-06 18:07:21 UTC
Permalink
----- Original Message -----
From: "jean-marc levecque" <jean-***@wanadoo.fr>
To: <***@miraclec.com>
Sent: Saturday, November 05, 2005 4:02 PM
Subject: [lazarus] Selecting a cell in a StringGrid
Post by jean-marc levecque
Hi,
SelectCell seam to have a strange behaviour.
After selecting by clicking a cell, if you move again the cursor over the
grid, its selecting the first cell reached by the cursor.
Also, the fixed rows/cols cannot be selected, and cell[0,0] is never selected
even when fixed rows/cols are set to 0.
I checked this with only a StringGrid with ShowMessage in onSelectCellEvent.
As I am not so sure of what should be the good behaviour, I compared to
Delphi, and there, any cell can be selected, no problem with the cursor back
over the grid.
Now, is there any other mean to select a cell, and use it for some action ?
Fixed in revision 8077, now if the grid lost focus while selecting it resets to normal state,
please test and let me know if I interpreted you report correctly

Jesus Reyes A.


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/
jean-marc levecque
2005-11-07 15:25:35 UTC
Permalink
Post by Jesus Reyes
----- Original Message -----
Sent: Saturday, November 05, 2005 4:02 PM
Subject: [lazarus] Selecting a cell in a StringGrid
Post by jean-marc levecque
Hi,
SelectCell seam to have a strange behaviour.
After selecting by clicking a cell, if you move again the cursor over the
grid, its selecting the first cell reached by the cursor.
Also, the fixed rows/cols cannot be selected, and cell[0,0] is never
selected even when fixed rows/cols are set to 0.
I checked this with only a StringGrid with ShowMessage in
onSelectCellEvent. As I am not so sure of what should be the good
behaviour, I compared to Delphi, and there, any cell can be selected, no
problem with the cursor back over the grid.
Now, is there any other mean to select a cell, and use it for some action ?
Fixed in revision 8077, now if the grid lost focus while selecting it
resets to normal state, please test and let me know if I interpreted you
report correctly
Jesus Reyes A.
Well, sorry, but I needed time to check this because I only used stable
versions up to today, and I had to start use of svn (making progress!!)
Finally, I got it.

So, now I tested the onSelectCell and the onSelection events.
In fact, the onSelection seems to work well, but the onSelectCell still
doesn't reply if you select the first cell i.e top-left one = 0,0 with fixed
rows/columns set to 0, or = 1,1 with fixed rows/columns set to 1.
BTW what should be the difference between these two events?
Now moving the cursor above the grid is ok

Thanks for the reply
Post by Jesus Reyes
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/
_________________________________________________________________
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
jean-marc levecque
2005-11-07 15:46:00 UTC
Permalink
Post by jean-marc levecque
Post by Jesus Reyes
----- Original Message -----
Sent: Saturday, November 05, 2005 4:02 PM
Subject: [lazarus] Selecting a cell in a StringGrid
Post by jean-marc levecque
Hi,
SelectCell seam to have a strange behaviour.
After selecting by clicking a cell, if you move again the cursor over
the grid, its selecting the first cell reached by the cursor.
Also, the fixed rows/cols cannot be selected, and cell[0,0] is never
selected even when fixed rows/cols are set to 0.
I checked this with only a StringGrid with ShowMessage in
onSelectCellEvent. As I am not so sure of what should be the good
behaviour, I compared to Delphi, and there, any cell can be selected,
no problem with the cursor back over the grid.
Now, is there any other mean to select a cell, and use it for some action ?
Fixed in revision 8077, now if the grid lost focus while selecting it
resets to normal state, please test and let me know if I interpreted you
report correctly
Jesus Reyes A.
Well, sorry, but I needed time to check this because I only used stable
versions up to today, and I had to start use of svn (making progress!!)
Finally, I got it.
So, now I tested the onSelectCell and the onSelection events.
In fact, the onSelection seems to work well, but the onSelectCell still
doesn't reply if you select the first cell i.e top-left one = 0,0 with
fixed rows/columns set to 0, or = 1,1 with fixed rows/columns set to 1.
BTW what should be the difference between these two events?
Now moving the cursor above the grid is ok
Thanks for the reply
Just an addition :
the first top-left cell cannot be selected as the first cell to select, but if
you select another one first, and then try to select this top-left one, it
works !
Post by jean-marc levecque
Post by Jesus Reyes
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/
_________________________________________________________________
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
Jesus Reyes
2005-11-07 16:55:09 UTC
Permalink
----- Original Message -----
From: "jean-marc levecque" <jean-***@wanadoo.fr>
To: <***@miraclec.com>
Sent: Monday, November 07, 2005 9:46 AM
Subject: Re: [lazarus] Selecting a cell in a StringGrid
Post by jean-marc levecque
Post by jean-marc levecque
Post by Jesus Reyes
----- Original Message -----
Sent: Saturday, November 05, 2005 4:02 PM
Subject: [lazarus] Selecting a cell in a StringGrid
Post by jean-marc levecque
Hi,
SelectCell seam to have a strange behaviour.
After selecting by clicking a cell, if you move again the cursor over
the grid, its selecting the first cell reached by the cursor.
Also, the fixed rows/cols cannot be selected, and cell[0,0] is never
selected even when fixed rows/cols are set to 0.
I checked this with only a StringGrid with ShowMessage in
onSelectCellEvent. As I am not so sure of what should be the good
behaviour, I compared to Delphi, and there, any cell can be selected,
no problem with the cursor back over the grid.
Now, is there any other mean to select a cell, and use it for some action ?
Fixed in revision 8077, now if the grid lost focus while selecting it
resets to normal state, please test and let me know if I interpreted you
report correctly
Jesus Reyes A.
Well, sorry, but I needed time to check this because I only used stable
versions up to today, and I had to start use of svn (making progress!!)
Finally, I got it.
So, now I tested the onSelectCell and the onSelection events.
In fact, the onSelection seems to work well, but the onSelectCell still
doesn't reply if you select the first cell i.e top-left one = 0,0 with
fixed rows/columns set to 0, or = 1,1 with fixed rows/columns set to 1.
OnSelectCell wasn't triggered for the focused cell, now it is (revision: 8093).
Post by jean-marc levecque
Post by jean-marc levecque
BTW what should be the difference between these two events?
With the recent changes the difference is now more subtle, OnSelectCell is called
through SelectCell which is a function to know if a given cell is selectable, can be
called any time by the grid or any descendant grid. Before the changes this wasn't
triggered for the current focused cell, now it is. if the cell's column is width 0, or
cell's row is height 0, OnSelectCell is called with parameter CanSelect:=False
bydefault.

OnBeforeSelection and OnSelection are notifications, are called only if there
there is a change in selection, first OnBeforeSelection and then when the
change has taken place OnSelection.

For example suppose that cell[1,1] is currently focused, if Cell[2,1] is not selectable and user
press the [RIGHT] key, OnSelectCell should be called two times, one for Cell[2,1]
and one for Cell[3,1], but OnSelection and OnBeforeSelection will be called just
one time.
Post by jean-marc levecque
Post by jean-marc levecque
Now moving the cursor above the grid is ok
Thanks for the reply
the first top-left cell cannot be selected as the first cell to select, but if
you select another one first, and then try to select this top-left one, it
works !
Jesus Reyes A.


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/

Loading...