Occurs when user enters a value that isn't in the lookup list.
property OnNotInList: TNotInListEventEh;
Write an OnNotInList event handler to take specific action when user enters a value that isn't in the lookup list. Event occur when lookup control is going to leave focus or dataset is going to post edited data.
procedure TForm1.DBLookupComboboxEh1NotInList(Sender: TObject; NewText: String; var RecheckInList: Boolean); begin if NewText = '' then raise Exception.Create('Empty value is not allowable.'); RecheckInList := True; if MessageDlg('Value "' + NewText + '" isn''t in the lookup list.' + #13 + ' Do you want to add this value to directory?', mtInformation, [mbYes, mbNo], 0) = mrYes then Table1.AppendRecord([9990,NewText]) else Abort; end;
Copyright (c) 1998-2013. All rights reserved.
What do you think about this topic? Send feedback!