Delphi XE之路(9)Delphi XE android mutilistview

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

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

 

Delphi XE之路(9)Delphi XE android mutilistview
Delphi XE之路(9)Delphi XE android mutilistview
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;
Delphi XE之路(9)Delphi XE android mutilistview

 

 

Delphi XE之路(9)Delphi XE android mutilistview

上一篇:Delphi XE之路(13)开发数据库三层应用的DataSnap


下一篇:delphi xe 之路(14)使用FireMonkeyStyle