Ver Mensaje Individual
  #2  
Antiguo 11-09-2012
LoPiTaL LoPiTaL is offline
Miembro
 
Registrado: abr 2009
Posts: 168
Reputación: 16
LoPiTaL Va por buen camino
Pues sería sencillo, añadiendo un método virtual, p. ej. DoOnShow (no sé si ya exista) que sea virtual.
Desde el padre, en el evento OnShow, llama a éste método, el cual se encarga de ejecutar lo del dataset que dices.
El formulario hijo sólo tendrá que sobreescribirlo y no llamar a inherited, por lo que dejaría de ejecutarse:

//El padre:
Código Delphi [-]
{ Conecto el dataset de la vista con el del form ABM o el Form ABM Master }
TFormPadre.OnShow(...)
begin
  DoOnShow;

  ActNuevo.Enabled := not (IsReadOnly);
  ActGuardar.Enabled := not (IsReadOnly);
  ActEditar.Enabled := not (IsReadOnly);
  ActDeshacer.Enabled := not (IsReadOnly);
  ActEliminar.Enabled := not (IsReadOnly);
end;

TFormPadre.DoOnShow;
begin
  if (IsABMDetail = false) and (IsABMLookup = false) and
     not (TfrmGenericGrid(MainForm.ActiveMDIChild).Entidad[6] = 'T') then
    dsChild.DataSet := TfrmGenericGrid(MainForm.ActiveMDIChild).cdsMaster;
end;

El hijo:

Código Delphi [-]
TFormHijo=class (TFormPadre)
protected
  procedure DoOnShow; override;
end;

procedure TFormHijo.DoOnShow;
begin
  //No quieres llamar a inherited para que no haga lo del dataset, por eso lo comento
  //inherited;

  //Cualquier otra cosa que el hijo tenga que hacer....
end;

Un saludo,
LoPiTaL
Responder Con Cita