Jump to content

Recommended Posts

Posted

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?

 

Call.png

Erro.png

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...