picyka Posted July 28, 2025 Posted July 28, 2025 When using the UnimComboBox mobile component to search, index not found errors occur. UnimComboBox -> Style = csDropDown procedure TUnimFormCadNegociacaoM.LoadMarcas(Tipo: Integer; Default : String); begin if (Tipo > 0) and (Self.cbMarca.Items.Count = 0) then begin var lMarcas := Self.FController.ServiceMarca.GetMarcas(Tipo); try for var lMarca in lMarcas do begin Self.cbMarca.Items.AddObject(lMarca.Id.ToString + '-' + lMarca.Nome, lMarca); end; finally lMarcas.Free; if Default <> '' then Self.cbMarca.ItemIndex := Self.cbMarca.Items.IndexOf(Default); end; end; end; This is how the combo is powered, what am I doing wrong? Quote
picyka Posted July 28, 2025 Author Posted July 28, 2025 It seems that when searching in the combo box, the onSelect event always fires, so a rule should be created to check if ItemIndex <> -1. This seems to solve the problem, following how it works. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.