Topic: Display combobox list depending on constraint
Hi,
I am a bit stuck with a script I want to implement to limit the list displayed in a combobox based on a checkbox in another field.
What I managed to do is actually to limit the content of the limit based on the status of the checkbox but, where I struggle is to display the current value and normal list if the checkbox is not checked.
Let's say I have a combobox pointing to 6 status. Normally this combobox displays the current status in database and if I drop it, I see all other status.
Now, I am automating a process where if I check a checkbox in a time picker, this status automatically displays status 4 and droplist is only status 4.
Problem is when I uncheck this box, I want to reset the combobox to where it should be with current status and all other status.
Current script looks like this:
procedure Admin_ReturnDate_OnChange (Sender: TObject);
begin
if Admin.ReturnDate.Checked= True then
begin
Admin.StatusList.dbFilter:= 'id=4';
Admin.StatusList.dbItemID:= 4;
Admin.StatusList.dbUpdate; // This works perfectly
end
else
Admin.StatusList.dbFilter:= 'id'; // This clears the combobox but list all possible status
Admin.StatusList.dbUpdate;
end;