function GetButtonEditValue(bedt: TccButtonEdit): string;

来源:互联网 发布:如何彻底卸载java mac 编辑:程序博客网 时间:2024/05/01 19:53

function GetButtonEditValue(bedt: TccButtonEdit): string;
var
  i: integer;
  j: Integer;
  strList: TStringList;
begin
  if not bedt.MultiSelect then
    raise Exception.Create('本方法只支持MultiSelect为True的ButtonEdit');

  strList := TStringList.Create;
  try
    strList.Delimiter := ',';
    strList.DelimitedText := bedt.Text;
    Result := '';
    for i:=0 to strList.Count-1 do
    begin
      j := bedt.Items.IndexOf(strList[i]);
      if j>-1 then
      begin
        if Result='' then
          Result := bedt.Values[j]
        else
          Result := Result+','+bedt.Values[j];
      end; 
    end; 
  finally
    strList.Free;
  end;
end;

原创粉丝点击