[lazarus] how to implement TDBListBox.Readonly

Michael Van Canneyt michael.vancanneyt at wisa.be
Mon Sep 15 07:08:57 EDT 2003

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.


More information about the Lazarus mailing list