Handling User Entry that's not in a Lookup Control lazarus / 16-Databases ---------------------------------------------------------------------- SteveF · 2010-12-22 19:27 As someone migrating to Lazarus/FPC from MS Access, I'd like to know if there is the equivalent of some Access behavior over here. What I'm looking to do is replicate certain behavior of either a Lookup Combo Box or Lookup List Box.  In Access both of these have a Boolean property called LimitToList, and an event named OnNotInList. When LimitToList is set to True, code can be added to the OnNotInList event to gracefully handle what should be done when a user enters an item that's not in the control's RowSource.  For example, a message box could be shown: "The item you entered is not in the list. Do you want to add it?   Yes       No" If answered Yes, a modal dialog lets the user confirm that the entry is correct, adds it to the table supplying the RowSource, and refreshes the control so the user can select the new entry. How can this be done in Lazarus?  I haven't been able to find similar properties or events on Lazarus' Lookup data controls, but this wouldn't be the first time I've missed something either obscure or non-intuitive.  If these properties/events are not available, suggestions/examples of how to do this in Lazarus would be welcome. Steve ---------------------------------------------------------------------- SteveF · 2010-12-28 16:11 No takers? ---------------------------------------------------------------------- marcov · 2010-12-29 12:20 Afaik lookuplists in Delphi/Lazarus are basically a readonly entity, so this would be hard. ---------------------------------------------------------------------- garlar27 · 2010-12-29 14:45 AFAIK you can't do that. The items contained in a LookUp (Combo/ListBox) are taken from a table. You can't add an item unless you add a record to the table which the field/control is looking for. What you CAN DO is add that value to a DBListBox or DBComboBox. ---------------------------------------------------------------------- SteveF · 2010-12-29 19:47 OK, that's what I kind of figured I'd have to do:  Use some other controls to actually add the new item to the table/view, then refresh the contents of the Lookup Combo. Thanks for the confirmation. Steve