[lazarus] how to implement TDBListBox.Readonly

Marc Weustink marc.weustink at cuperus.nl
Mon Sep 15 06:22:22 EDT 2003


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

Marc






More information about the Lazarus mailing list