The only thing I could really come up with that was viable was to reset the Itemindex to -1 after someone clicks it. The code below shows the easy way.
Simba Code:
program formTemplate;
var
Form: TForm;
TCom: TCOMBOBOX;
procedure Change(Sender: TObject);
begin
if InIntArray([0, 4], Tcom.ITEMINDEX) then
Tcom.ITEMINDEX := -1;
end;
procedure formInit;
begin
form := TForm.create(nil);
with form do
begin
caption := 'Form Template';
SetBounds(100, 100, 115,40);
end;
TCom := TCOMBOBOX.Create(Form);
with TCom do
begin
SetBounds(5,5,100,30);
Parent := Form;
FONT.Color := clGray;
CANVAS.Font.Color
ITEMS.Add('----Fruit----');
ITEMS.Add('Apple');
ITEMS.Add('Pear');
ITEMS.Add('Orange');
ITEMS.Add('----Veggie----');
ITEMS.Add('Carrot');
ITEMS.Add('Potato');
ITEMS.Add('Mushroom');
ITEMS.Add('Bellpepper');
ONCHANGE := @Change;
end;
form.showModal;
end;
procedure formSafeCall(proc: string);
var
v: TVariantArray;
begin
setLength(v, 0);
threadSafeCall(proc, v);
end;
procedure formFree();
begin
form.free();
end;
begin
clearDebug();
try
formSafeCall('formInit');
except
writeln(exceptionToString(exceptionType, exceptionParam));
finally
formSafeCall('formFree');
end;
end.
~BraK