Para hacer lo que quiere tienes que hacer que "pa" sea un objecto.
Código Delphi
[-]type
TPa = class
private
Fid_paciente: Integer;
FApellido: String;
FNombre: String;
Fdni: Integer;
Fobra_social: String;
Ffecha_nac:String;
Fciudad: String;
Fdir: String;
Ftel: Integer;
Femail: String;
public
property id_paciente: Integer read fid_paciente write fid_paciente;
property Apellido: String read FApellido write FApellido;
property Nombre: String read FNombre write FNombre;
property dni: Integer read Fdni write Fdni;
property obra_social: String read Fobra_social write Fobra_social;
property fecha_nac:String read Ffecha_nac write Ffecha_nac;
property ciudad: String read Fciudad write Fciudad;
property dir: String read Fdir write Fdir;
property tel: Integer read Ftel write Ftel;
property email: String read Femail write Femail;
end;
var
pa: TPa;
Después haces
Código Delphi
[-]While not zQuery1.eof do
begin
pa := TPa.Create;
pa.id_paciente:= zQuery1.FieldByName('id_paciente').AsInteger;
pa.Apellido:=zQuery1.FieldByName('apellido').AsString;
pa.Nombre:=zQuery1.FieldByName('nombre').AsString;
pa.dni:=zQuery1.FieldByName('dni').AsInteger;
pa.obra_social:=zQuery1.FieldByName('obra_social').AsString;
pa.fecha_nac:=zQuery1.FieldByName('fecha_nacimiento').AsString;
pa.ciudad:=zQuery1.FieldByName('ciudad').AsString;
pa.dir:=zQuery1.FieldByName('direccion').AsString;
pa.tel:=zQuery1.FieldByName('telefono').AsInteger;
pa.email:=zQuery1.FieldByName('email').AsString;
listaPacientes.Items.AddObject(pa.Apellido+' '+pa.Nombre,pa);
zQuery1.Next;
end;
y luego
Código Delphi
[-]if(listaPacientes.ItemIndex>-1)then
begin
pa:=TPa(listaPacientes.Items.Objects[listaPacientes.ItemIndex]);
paApellido.Text:= pa.Apellido;
paNombre.Text:=pa.Nombre;
paDNI.Text:=IntToStr(pa.dni);
paObraSocial.Text:=pa.obra_social;
paCiu.Text:=pa.ciudad;
paTel.Text:=IntToStr(pa.tel);
paMail.Text:=pa.email;
end;
Espero que te sirva
Un saludo.