----- Original Message -----
From: "Graeme Geldenhuys" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, April 19, 2007 4:48 PM
Subject: Re: [lazarus] [patch] - grids.pas (Click event)
On 4/19/07, Jesus Reyes <[EMAIL PROTECTED]> wrote:
> * Click fires twice when selecting a range (not sure why)
If it's by selection using the mouse it could be because using the
mouse will trigger one click normally and now (If I'm no wrong, in
hunk @@ -4328,7 +4330,10 @@) one additional click was introduced.
Yes, it was selection using a mouse. I'll make the change tomorrow in
my copy and see how things go. Thanks.
> * On loosing focus in a TStringGrid, it doesn't show the last
> selected cell. Compared to Delphi the cell's background should be
> painted with the selection color (but no focus rectangle).
>
This is one of the features of delphi grids I never liked there is no
way to disable it (or at least I didn't know how), so I didn't
implement it, however if you add option goDrawFocusSelected it should
show it as you describe.
Yes, the goDrawFocusSelected solves that problem and wonder if it
should be enabled by default. If not, every developer can enable that
when required I guess. I just thought it looks odd loosing focus and
not have any hint as to what was selected in the grid.
That's what options are for, and after years I don't remember of nobody
requesting the change until now, which means that either the grid is not
used too much or this feature it's not too important.
IMO a Click is (or should be) caused only for a mouse action, and
having it triggered when a key is pressed or programmatically, start
to make things confusing.
There is (IMHO) a better event: OnSelection, this triggers every time
selection has moved for whatever cause, mouse, keyboad or by
programmatically moving Row or Col.
Well, seeing that Lazarus is trying to be Delphi compatible, maybe we
should keep following that. No point in having some components follow
Delphi and others not.
I don't expect all components to meet 100% compatibility objective (and I
think this is not Lazarus Team goal, can correct me if I'm wrong, lcl is not
(and I don't expect to be) a vcl clone). Full compatibility is at the same
time, very difficult to obtain (or impossible), wished (I don't want to
dismiss the importance of compatiblity), not wished (why would we need to
duplicate bugs or inconsistencies?), or not important (not all users of
lazarus are users of delphi).
As for the Click being confusing when triggered by a key press, many
other components do the same as far as I can remember. Spacebar or
Enter causes a click event on a button, spacebar on checkbox, etc..
Some times it makes sense and sometimes it does not. I think that people
sometimes makes a choice because of practical reasons and others so because
they are more intuitive, and that's why we sometimes end with a practical
mess.
In the grid case I see the only thing it improves is compatiblity, not need
to argue that for me it doesn't result intuitive, yet it's a positive change
so I already agreed to add the feature.
However, if we should add click for compatibility reasons, from the
patch I can see the missing clicks are those who have to do with
selection change, then I propose to do it within MoveExtend before or
That was my first attempt. <smile> I added the call to Click in the
MoveExtend and it seem to work well, until I started monitoring the
amount of Click events being fired. There was a lot of places where
the Click event fire up to three times with one user change. With my
limited knowledge of the internals of TCustomGrid made it really hard
to debug, so the quicker solution for me was what I have done in the
patch.
Probably, I didn't see in your patch that you have overriden click method,
that might explain the increased number of clicks, but without seeing the
original patch and test code it's difficult to guess the cause.
Anyway according to the way delphi works, it looks like it's a good
candidate.
PS:
This is ending up being a good learning curve for me. Soon I want to
start implementing more features or improving the existing ones in the
fpGUI StringGrid. I'm sure the knowledge I get here, will help me
later.
--
Graeme Geldenhuys
There's no place like S34° 03.168' E018° 49.342'
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