[lazarus] how to implement TDBListBox.Readonly
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Sep 15 11:20:30 EDT 2003
On Mon, 15 Sep 2003 08:17:26 -0400
Andrew Johnson <acjgenius at earthlink.net> wrote:
> Just to clarify here, we have a readonly property(all db aware controls
> do in delphi afaik), this sets the datalink readonly property to true or
> false. If its readonly then calling edit will validate false(I think)
> and apears to work in the DBEdit. now when the fieldlink is readonly we
> don't _want_ changes to happen same as when we aren't in editing(ala in
> browse) mode. Since a list set changes the field value to one in the
> list then we can't even let it change selection. So to make sure its
> properly readonly we need to prevent changing. I overrode click and
> keydown, but some messages still seem to be getting through. I tested
> this in Delphi4 and got what I expected - if I click something when
> readonly, nothing happens, in mine sometimes the selection changes...
> thats the issue.
>
> I will try and implement keydown later too see if I can catch arrow,
> home page up/down and end there so they don't change selection.
I think, we should add the ReadOnly feature to TCustomListBox.
And there are other ways than keys to change the selection. Maybe you should
also implement a reset, when the selection changes.
I will take one of the other TDBxxx controls. What about TDBRadioGroup?
Mattias
>
> (btw this is in cvs now if you want to look at what I mean)
>
> Andrew
>
> On Mon, 2003-09-15 at 07:12, Michael Van Canneyt wrote:
> > On Mon, 15 Sep 2003, Marc Weustink wrote:
> >
> > > + From: Andrew Johnson [mailto:acjgenius at earthlink.net]
> > > + Sent: maandag 15 september 2003 3:34
> > > +
> > > + I just decided to do TDBListBox since I figured it should be another
> > > + easy one, but I forgot about readonly. With Edti I could use
> > > inherited+ readonly to make sure it was uneditable, but with listbox
> > > there is no+ such thing. So I need to figure out how to handle this. I
> > > think I just+ need to add events for all mouse and keyboard events
> > > which would change+ the selection. So I wonder what all I need to be
> > > catching. obviously I+ need to do a KeyPress like I did with text,
> > > just add a test to make sure+ TFieldDataLink.Edit validates and if not
> > > set the Key to #0. However I am+ not sure what all else will need to
> > > be handled. aka what functions and+ within those functions what needs
> > > to be trapped.+
> > > + If anyone knows please tell me :)
> > > +
> > > + KeyPress won't get the arrow keys will it?
> > >
> > > Nope. KeyDown/Up will get all keys, KeyPress only those keys who
> > > return a valid ASCII char.
> > >
> > > I just had a peek at the VCL and Readonly is handled through the
> > > DataLink. If I understand what is happening, the ListBox isn't
> > > readonly. Only the dataset isn't set to Edit when changing something
> > > in the listbox.
> >
> > The listbox should do that using TFieldDataLink.Edit, this will return
> > true if the dataset is successfully set in editmode.
> >
> > Michael.
> >
> > _________________________________________________________________
> > To unsubscribe: mail lazarus-request at miraclec.com with
> > "unsubscribe" as the Subject
> > archives at http://www.lazarus.freepascal.org/mailarchives
>
> _________________________________________________________________
> To unsubscribe: mail lazarus-request at miraclec.com with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
--
More information about the Lazarus
mailing list