Ver Mensaje Individual
  #10  
Antiguo 03-12-2007
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 29
Lepe Va por buen camino
Lo que deberías hacer es derivar de TObjectList y crearte tu propia lista, simplificará mucho las cosas.

Código Delphi [-]
TRows = class(TObjectList)
 private
   { private declarations }
 protected
   { protected declarations }
    function GetItem(Index: Integer): TwwGrid;
    procedure SetItem(Index: Integer; ARow: TwwGrid);

 public
   { public declarations }
  property Items[index:integer] : TwwGrid read GetItem write SetItem;
  function Busca(Nombre:string):integer;
 published
   { published declarations }
 end;
implementation

function TRows.GetItem(Index: Integer): ;
begin
  Result := TwwGrid(inherited GetItem(index));
end;

procedure TRows.SetItem(Index: Integer; ARow: TwwGrid);
begin
  inherited SetItem(index, ARow);

end;

function TRows.Busca(Nombre:string):integer;
begin
   for Result := 0 to Count -1 do
     if items[i].Name = Nombre then
        Exit;
   Result:= -1;
end;
Ahora ya tienes redefinido el TobjectList para guardar Grids de tu propio tipo.
Si quieres buscar uno:
Código Delphi [-]
var idx:integer;
begin
  idx := ListaGrids.Busca('dbgrid1');
  if idx <> -1 then
    PageControl1.ActivePage := TTabsheet(ListaGrids[i].Parent);
end;

... Hay formas mejores, pero tendrías que modificar mucho, no sé si será viable. Si estas interesado, pregunta.

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita