How to call ComboBox1Select(nil) one after another?

Example 1:

 ComboBox1.ItemIndex := 0; ComboBox1Select(nil); ComboBox1.ItemIndex := 1; ComboBox1Select(nil); // Так не получается вызывает последний ItemIndex 

Example 2:

 for i := 0 to ComboBox1.Items.Count -1 do begin ComboBox1.ItemIndex := i; ComboBox1Select(nil); end; // Так тоже не получается 

Actually the question is how to call all ComboBox1.ItemIndex in a row one by one through the call ComboBox1Select(nil) can the place nil some parameter?

Update

I do not want to change everything, everything works for me through the onselect event. Suppose combobox1.itemsindex := 0 and the program yielded the result and so when selecting itemsindex. It turns out the result corresponding to this itemsindex . I would like not to change all the code, but on the other button, go to itemsindex and select in turn so as to bypass from first to last. For example, in a loop or something else. So I saw a solution in which ComboBox1Select(nil) can run ComboBox1.ItemIndex := 0; , but in fact it runs only once, but I need to go through everything. Above wrote how I tried and what did not work out.

  • Please specify what exactly you want to do, format the text of the question. And what is in your ComboBox1Select code? - Kromster
  • ComboBox1Select(ComboBox1); also does not work? - Alekcvp
  • And what does your ComboBox1Select do? - kot-da-vinci
  • Please do not register as a new user for each of your messages. Try to clearly explain what you want to achieve by editing the original question. - Igor
  • Everything works great with ComboBox1Select(nil); You write ShowMessage('ОК') in this event and see the result. Most likely, the data just as you say is formed very quickly and only the last result is visible. - androschuk

1 answer 1

Try this:

 for i := 0 to ComboBox1.Items.Count -1 do begin ComboBox1.ItemIndex := i; ComboBox1Select(nil); Application.ProcessMessages; end; 

But this is a bad decision. It is better to avoid calling Application.ProcessMessages , since This slows down the application and can lead to unpredictable consequences.

  • ComboBox1Select (ComboBox1); this doesn't work either, it works only once - user207578
  • it still calls the latest ComboBox1.ItemIndex tenth in a row - user207588
  • one
    Show us what your ComboBox1Select does? Maybe you just do not have time to notice the result? - kot-da-vinci

Protected by spirit community member 11 Apr '16 at 13:50 .

Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

Maybe you want to answer one of the unanswered questions ?