Jump to content


Photo

TNxComboBox6 IndexOf Equivalent.


  • Please log in to reply
2 replies to this topic

#1 Speed

Speed
  • Members
  • 195 posts
  • Gender:Male

Posted 10 April 2021 - 03:25 AM

Hi Boki,

 

I was using an TRzComboBox and replaced it with a TNxComboBox. 

 

Is the SearchFor method the equivalent of the IndexOf method?

 

It doesn't seem to find the text I'm looking for, ie. it returns -1.

Thanks.

 

= Steve

 



#2 Speed

Speed
  • Members
  • 195 posts
  • Gender:Male

Posted 10 April 2021 - 04:04 AM

Hi Boki,

 

I ended up just writing a method.

cmbClient.ItemIndex := GetClientItemIndex(Client);


function TfrmAppointment.GetClientItemIndex(AClientName: string): integer;
var
   i: integer;
begin
   Result := -1;

   for i := 0 to cmbClient.Items.Count - 1 do
   begin
      if SameText(cmbClient.Items[i], AClientName) then
      begin
         Result := i;
         Break;
      end;
   end;
end;

= Steve



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 12 April 2021 - 10:35 AM

Hi Steve,

 

Sorry for delay. I will think about adding similar method to be built in the component.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users