Ver Mensaje Individual
  #1  
Antiguo 26-01-2007
Negegoca Negegoca is offline
Registrado
 
Registrado: dic 2006
Ubicación: Costa Rica
Posts: 1
Reputación: 0
Negegoca Va por buen camino
Question In Design: Control no has parent window

Tengo varios días tratando de corregir este error, solo me da en tiempo de diseño, basicamente es un TEdit multi-uso (Alianeación, numeros con formato, decimales, un caracter fijo, etc), el componente funciona perfectamente en run-time, pero en Design-time me da el error: 'Control "TEditEx1" no has parent window' y lo borra del formulario. He leido varios foros (en ingles) y no dan una solución concreta solo dicen que el error se da en "CreateWnd" de TWinControl. Pongo el código para que se den una idea...

Código Delphi [-]
{**** TCustomEditEx *****}
constructor TCustomEditEx.Create(AOwner: TComponent);
begin
   Inherited Create(AOwner);
   FRangeChar := [];
   FFixedChar := #0;
   FFixedPos := fpLeft;
   FHasSign := False;
   FDecimals := 0;
   FThousands := False;
   FNumPadDot := False;
   FValidChars := [];
   FPorcent := False;
   Formating := False;
   _FixedChar := False;
   FCreating := True;
   FAlignment := taLeftJustify;
   FRangeChar := [rcNumber, rcAlpha, rcSymbol, rcExtended];
end;

procedure TCustomEditEx.CreateWnd;
var
  FixedWidth: LongInt;
begin
   FCreating := True;
  try
     inherited CreateWnd; { <-- Aquí adentro es el error, especificamente en TWinControl.CreateWnd: 
     ... 
     if (WndParent = 0) and (Style and WS_CHILD <> 0) then
        if (Owner <> nil) and (csReading in Owner.ComponentState) and
           (Owner is TWinControl) then
           WndParent := TWinControl(Owner).Handle
        else
           raise EInvalidOperation.CreateFmt(SParentRequired, [Name]);
     ... 
     }
  finally
     FCreating := False;
  end;
  if FFixedChar <> #0 then
   begin
      if FFixedPos = fpLeft then
         FixedWidth := MakeLong(GetFixedWidth, 0)
      else
         FixedWidth := MakeLong(0, GetFixedWidth);
      SendMessage(Handle, EM_SETMARGINS, EC_LeftMargin or EC_RightMargin, FixedWidth);
   end;
end;

procedure TCustomEditEx.CreateParams(var params: TCreateParams);
const
   Styles : Array [TAlignment] of DWORD = (ES_LEFT, ES_RIGHT, ES_CENTER );
begin
   inherited;
   params.style := params.style or Styles[FAlignment];
end;

destructor TCustomEditEx.Destroy;
begin
   inherited Destroy;
end;

Elimine todo posible llamada al Api o al VCL usando tecnicas de Borland pero nada, sigue el mismo error...


Si quieren todo el resto del código, solo diganme donde subirlo

Estaba identado, no se que paso cuando lo pegé... :-p

Última edición por Negegoca fecha: 27-01-2007 a las 07:53:33.
Responder Con Cita