Delphi XE5 android listview

Posted on 2013-10-15 15:12  至今  阅读(6801)  评论(9编辑  收藏  举报

C:\Users\Public\Documents\RAD Studio\12.0\Samples\FireMonkeyMobile\ListView

路径下有两个dpk,装完后listview也能实现listbox的效果了

 

procedure TFormMain.FillListBox;
var
  // item:TMetropolisUIListBoxItem;
  // listitem:TListboxItem;

  p: PpatientData;
  LItem: TListViewItem;
  i: Integer;
begin
  ListViewPatient.Items.Clear;
  if not cdspatientlist.Active then
    Exit;
  ListViewPatient.BeginUpdate;
  try
    with cdspatientlist do
    begin
      DisableControls;
      try
        i := 1;
        First;
        while not Eof do
        begin
          New(p);
          p.patient_id := FieldByName('patient_id').AsString;
          p.admiss_times := FieldByName('admiss_times').AsInteger;
          p.inpatient_no := FieldByName('inpatient_no').AsString;
          p.bed_no := FieldByName('bed_no').AsString + '';
          p.nurse_level := FieldByName('nurse_level').AsString;
          p.diag := FieldByName('diag').AsString;
          p.name := FieldByName('name').AsString;
          p.sex := FieldByName('sex').AsString;
          p.age := FieldByName('age').AsString;
          p.charge_total := FieldByName('charge_total').AsString;
          p.yue := FieldByName('yue').AsString;

          LItem := ListViewPatient.Items.Add;
          LItem.Text := p.bed_no;

          LItem.Data[TMultiDetailAppearanceNames.Detail1] := '姓名    :' + p.name;
          LItem.Data[TMultiDetailAppearanceNames.Detail2] := '护理等级:' +
            p.nurse_level;
          LItem.Data[TMultiDetailAppearanceNames.Detail3] := '诊断    :' + p.diag;

          if p.sex = '' then
            LItem.BitmapRef := (Image1.MultiResBitmap.Items[0].Bitmap)
          else if p.sex = '' then

            LItem.BitmapRef := (Image1.MultiResBitmap.Items[1].Bitmap);

          if p.sex = '1' then
            LItem.BitmapRef := Image1.MultiResBitmap.Items[1].Bitmap
          else
            LItem.BitmapRef := Image1.MultiResBitmap.Items[0].Bitmap;

          Inc(i);
          Next;

        end;
      finally
        EnableControls;
      end;

    end;
  finally
    ListViewPatient.EndUpdate;
  end;

end;
View Code

 

 

 

Copyright © 2024 至今
Powered by .NET 9.0 on Kubernetes