I have a combobox with autocomplete turned on
When I type in part of the mac it will pull up the entry as its supposed to but the on change event does not fire. I have tried onkeypress and it did not work either
What event can I use?
Please help!
procedure Tformblackhole.ComboBoxcurrentmacChange(Sender: TObject);
var
SelectedItem: string;
SeparatorPos1, SeparatorPos2: Integer;
MacAddress, Vlan, Reasontxt: string;
begin
SelectedItem := ComboBoxcurrentmac.Text;
// Find the positions of both separators (colons)
SeparatorPos1 := Pos(':', SelectedItem);
SeparatorPos2 := Pos(':', SelectedItem, SeparatorPos1 + 1); // Start search after the first colon
if (SeparatorPos1 > 0) and (SeparatorPos2 > 0) then // Check if both colons are found
begin
// Extract MAC, VLAN, and Reason
MacAddress := Copy(SelectedItem, 1, SeparatorPos1 - 1);
Vlan := Copy(SelectedItem, SeparatorPos1 + 1, SeparatorPos2 - SeparatorPos1 - 1);
Reasontxt := Copy(SelectedItem, SeparatorPos2 + 1, Length(SelectedItem) - SeparatorPos2);
// Set the values of mac, vlan, and reason text fields
editmac.Text := MacAddress;
spineditvlan.Text := Vlan;
reason.Text := Reasontxt; // Assuming you have an editreason text field
end;
end;