xe5 android listbox的 TMetropolisUIListBoxItem

listbox实现以下效果:

xe5 android listbox的 TMetropolisUIListBoxItem

关键代码,采用数据集的方式

复制代码
type

  PpatientData=^RpatientData;

  RpatientData= record

     patient_id:string;

     admiss_times:Integer;

     inpatient_no:string;

     name:string;

     sex:string;

     bed_no:string;

     nurse_level:string;

     diag:string;

   end;



                                                                                       















var

   item:TMetropolisUIListBoxItem;

   p:PpatientData;

begin

    with cdspatientlist do

    begin

     DisableControls;

         try

          First;

             while not Eof  do

             begin

                 New(p);

                 p.patient_id:=FieldByName('inpatient_no').AsString;

                 p.admiss_times:=1;

                 p.inpatient_no:=FieldByName('inpatient_no').AsString;

                 p.bed_no:=FieldByName('inpatient_no').AsString+'';

                 p.nurse_level:=FieldByName('nurse_level').AsString;

                 p.diag:=FieldByName('diag').AsString;

                 p.name:= FieldByName('name').AsString;

                 p.sex:=FieldByName('sex').AsString;

                 item:=TMetropolisUIListBoxItem.Create(ListBoxPatient);

                 item.Font.Size:=14;

                 item.Title:='姓名:'+p.name+'-'+'    性别:'+p.sex;

                 item.SubTitle:=p.bed_no+'    护理:'+p.nurse_level;

                 item.Description:='诊断:'+p.diag ;

                 if p.sex='' then

                 item.Icon.Assign(Image1.MultiResBitmap.Items[0].Bitmap)

                 else

                 item.Icon.Assign(Image1.MultiResBitmap.Items[1].Bitmap);

                 ListBoxPatient.AddObject(item);

                 Next;

             end;

         finally

          EnableControls;

         end;

    end;
复制代码

 

 

你可能感兴趣的:(android)