[fpc-devel] Include() and Exclude() with read-only property

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Dec 10 09:53:12 CET 2007


On 10/12/2007, Micha Nelissen <micha at neli.hopto.org> wrote:
>
> Include needs a var parameter, i.e. it needs to be able to take address
> of the expression you supply as first param. ComponentState is a
> property, and you can't take the address of a property -> error.


But why does it then _work_ under Linux and Windows (FPC 2.0.4 and FPC 2.2.0)?
I can compile fpGUI without any issue under Linux using FPC 2.2.0 and
code like the following...

-------[ CUT ] ------------
constructor TfpgWidget.Create(AOwner: TComponent);
begin
  Include(ComponentState, csLoading);
  FOnScreen   := False;
  FVisible    := True;
  FActiveWidget := nil;
  FEnabled      := True;
  FFocusable  := False;
  FFocused    := False;
  FTabOrder   := 0;
  FAnchors    := [anLeft, anTop];
  FAlign      := alNone;
  FHint       := '';

  if (AOwner <> nil) and (AOwner is TfpgWidget) then
    Parent := TfpgWidget(AOwner)
  else
    Parent := nil;

  if Parent <> nil then
    FWindowType := wtChild;

  inherited;

  // This is for components that are create at runtime, after it's
  // parent has already been shown.
  if (Parent <> nil) and (Parent.HasHandle) then
  begin
    InternalHandleShow;
  end;

  Exclude(ComponentState, csLoading);
end;
----------[ END ]------------------



TfpgWidget's inheritance looks like the following:

    TfpgWidget
        |
    TfpgWindow
        |
    TfpgWindowImpl
        |
    TfpgWindowBase
        |
    TComponent
       ?
    TObject



Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list