Форум: "Основная";
Текущий архив: 2002.01.10;
Скачать: [xml.tar.bz2];
ВнизКак отсортировать список в ComboBox типа Integer, т.е. 10 после 9 а не наоборот Найти похожие ветки
← →
MBo (2001-12-23 09:38) [1]так как в Комбо нет Custom сортировки, то можно так
function SortByVal(L: TStringList;I1,I2: Integer): Integer;
begin
result:=0;
try
if strtoint(l[i1])>strtoint(l[i2]) then result:=1
else if strtoint(l[i2])>strtoint(l[i1]) then result:=-1;
except
if l[i1]>l[i2] then result:=1
else if l[i2]>l[i1] then result:=-1;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var s:tstringlist;
begin
s:=tstringlist.create;
s.assign(cb1.items);
s.CustomSort(SortByVal);
cb1.items.assign(s);
s.free;
end;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.01.10;
Скачать: [xml.tar.bz2];
Память: 0.43 MB
Время: 0.002 c