I'm currently displaying "merchandise" in a ListView, the listview has article, quantity, iemsls and name.
On DoubleClick of the item I want to read the variables and put them in TEdit field, and 'iemsls' in a ComboEdit which has items pre-written, how can I check which item from the ComboEdit equals the same as of the String and set it to that?
igiDoubleTap:
begin
global_norakstisanadoc_editing := true;
SelectedItemIndex := F_SS_MAIN.ListView2.Selected.index;
ListView2.Enabled := false;
SpeedButton6.Enabled := false;
SpeedButton7.Enabled := false;
quant_bef := (TListItemText(F_SS_MAIN.ListView1.Items.AppearanceItem[index].Objects.FindDrawable('Text2')).Text);
quant_aft := StringReplace(quant_bef, 'gb', '', [rfReplaceAll, rfIgnoreCase]);
Edit_artikuls_norakstisana.Text := ListView2.Items.Item[SelectedItemIndex].View.FindObject('artikuls').Data.ToString;
edit_daudzums_norakstisana.Text := quant_aft;
label_prece_from_ean.Text := ListView2.Items.Item[SelectedItemIndex].View.FindObject('prece').Data.ToString;
ComboEdit := ListView2.Items.Item[SelectedItemIndex].View.FindObject('iemsls').Data.ToString;
end;
This is currently the DoubleTap method I'm using
forloop is an unconditional loop, it will run until it reached the ends of its index. If you want your loop to stop on a condition, use a conditional loop, such aswhile doorrepeat untilThere are ways to break from aforloop, but IMO you have used the wrong loop when you need that