Ver Mensaje Individual
  #7  
Antiguo 20-12-2011
kamuspik kamuspik is offline
Miembro
NULL
 
Registrado: oct 2011
Posts: 11
Reputación: 0
kamuspik Va por buen camino
Hola,

he conseguido solucionar el problema verificando si el Grid asociado al DataSet tiene la propiedad Showing a True. De esta forma cuando el programa se encuentre dentro del código de OnCreate y todavía no se este mostrando el Grid no ejecutará la instrucción DisableControls.

Código para obtener el Grid asociado al DataSet:

Código Delphi [-]
function GetGridAsociado: TDBGrid;
var
  I: integer;
begin
  Result := nil;

  for I := 0 to Owner.ComponentCount - 1 do
    if Owner.Components[i] is TDBGrid then
      if TDBGrid(Owner.Components[i]).DataSource <> nil then
        if TDBGrid(Owner.Components[i]).DataSource.DataSet = Self then
          begin
            Result := TDBGrid(Owner.Components[i]);
            Break;
          end;
end;

Código para comprobar si se está mostrando el Grid:

Código Delphi [-]
if GetGridAsociado.Showing then
    Self.DisableControls;
No dudéis en realizar cualquier comentario sobre el código, muchas gracias por las respuestas, me han hecho ir en la dirección correcta.

Un saludo

Última edición por kamuspik fecha: 20-12-2011 a las 10:09:37. Razón: Errata
Responder Con Cita