----- Original Message ----- 
From: "jean-marc levecque" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 9:46 AM
Subject: Re: [lazarus] Selecting a cell in a StringGrid


> Le lundi 7 Novembre 2005 16:25, vous avez écrit :
> > Le dimanche 6 Novembre 2005 19:07, Jesus Reyes a écrit :
> > > ----- Original Message -----
> > > From: "jean-marc levecque" <[EMAIL PROTECTED]>
> > > To: <[email protected]>
> > > Sent: Saturday, November 05, 2005 4:02 PM
> > > Subject: [lazarus] Selecting a cell in a StringGrid
> > >
> > > > 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).

> > 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. 

> > 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 !
> >

Jesus Reyes A.


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

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to