Ver Mensaje Individual
  #3  
Antiguo 25-07-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Proba si te sirve de este modo:
Código Delphi [-]
...
implementation

type
 TNodeData = class
    sText : string;
    iIDpro: Integer;
    iIdAlmacen:Integer;
    SNombreAlmacen:string;
  end;

(* Cargar datos de prueba *)
procedure TForm1.FormShow(Sender: TObject);
var
  c,f,x: Integer;
  ND: TNodeData;
begin
  x:= 1;
  for f:= StrGrd.FixedRows to StrGrd.RowCount-1 do
   for c:= StrGrd.FixedCols to StrGrd.ColCount-1 do
   begin
     ND:= TNodeData.Create;
     ND.sText:= IntToStr(f)+':'+IntToStr(c);
     ND.iIDpro:= x;
     ND.iIdAlmacen:= x;
     ND.SNombreAlmacen:= 'Almacen:'+IntToStr(f)+':'+IntToStr(c);
     StrGrd.Cells[c,f]:= ND.SNombreAlmacen;
     StrGrd.Objects[c,f]:= ND;
     Inc(x);
   end;
end;

(* mostrar datos de objeto asociado a celda *)
procedure TForm1.StrGrdClick(Sender: TObject);
begin
  with TNodeData(StrGrd.Objects[StrGrd.Col,StrGrd.Row]) do
   ShowMessage(sText+#10#13+
               IntToStr(iIDpro)+#10#13+
               IntToStr(iIdAlmacen)+#10#13+
               SNombreAlmacen)
end;

...

(* liberar memoria *)
procedure TForm1.FormDestroy(Sender: TObject);
var
  f,c: Integer;
begin
  for f:= StrGrd.FixedRows to StrGrd.RowCount-1 do
   for c:=  StrGrd.FixedCols to StrGrd.ColCount-1 do
     StrGrd.Objects[c,f].Free;
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita