[lazarus] Questions about DB status
Andrew Johnson
acjgenius at earthlink.net
Sun Sep 14 13:41:45 EDT 2003
On Sun, 2003-09-14 at 10:46, Marc Weustink wrote:
> At 21:21 13-9-2003, Andrew Johnson wrote:
> >On Sat, 2003-09-13 at 11:19, Andrew Johnson wrote:
> > > Actually I am not so sure on this for one reason. I am still not sure
> > > _why_ it needs this, but I just found and added the following routine to
> > > it(I find its existence atm utterly pointless and silly but ..
> > > compatibility?)
> >
> >The more I think the more I think we should scratch it.
>
> I don't.
>
> >I see no use whatsoever even for backward compatibility.
>
> It isn't a matter of backward compatebility, I think it is needed.
>
> >When would anyone want to
> >focus a FielddataLink 's control and not know the control already?
>
> IF I look at the implementation of it in D7 the FocusControl makes sense.
> It is defined in DB and is part of TField and it is used when checking
> required fields. The DB unit has no knowledge about controls itself, it
> only signals though the DataLink that an attached control should get focus.
> For the controls there is the derived TFieldDataLink.
>
> How would you suggest would the TFieldDataLink know which control is attached ?
>
> >in which case they could call it before hand.
>
> It is not for ppl. to call the setfocus, it is the underlying field it self.
>
> Marc
>
hrmmmmmm.
OK I think I can see when it might be used then.
But I don't understand why this needs to be a function accessing
tcontrol/twincontrol in the DataLink itself, every other update function
is done by attatching a callback to the datalink from the dataaware
control. If a control _can_ recieve focus it should assign its own
routine to handle that, or have a special DataLink like dbgrid needs(and
even then I don't see what it would need that couldn't be done better
with callbacks/messages).
So maybe implementing this routine is ok, but having TFieldDataLink do
the setting of focus itself still seems silly. It should inform the
control that focus is requested and the control can set itself. A simple
callback should suffice.
A FieldDatalink is going to be attatched to a single control with a
single field. Thats its purpose. It shouldn't need to know what the
control is or if its even a tcontrol, thats why we have messages and
callbacks. So if I add this I would far prefer an OnRequestFocus
callback. It would allow this to be in db later on, without losing this
functionality. It wouldn't be entirely backward compatible but I don't
see it as a large problem if someone ports an existing db control to add
a function to setfocus if needed, plus if implemented this way in the
parent DataLink class it would allow a dbrid and its datalink to handle
which control to set focus too in a row for instance in the event it is
using a custom control for editing a column, but without requiring to
much additional functionality in its own DataLink.
So would that suffice? or do you stil think we should do it the Delphi
way? It's easy to implement either way, so long as the functionality is
properly added to the pertinent portions of db. (db currently knows
nothing of this or maskedit, and text vs displaytext doesn't work, so
anything visual backend in db will need work/implementing anyway. so it
doesn't matter which way we do it from that perspective)
Andrew
More information about the Lazarus
mailing list