Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-12

Include() and Exclude() with read-only property

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I received a bug report today. I was able to set a read-only property under Linux and Windows without any issues - I didn't notice the property was read-only! The bug report mentions that an compiler error is raised under FreeBSD, but not under Linux or Windows? What is the correct behaviour? I would guess, seeing that it was a Read-Only property, FreeBSD is giving the correct behaviour.

I was using FPC 2.0.4 and now FPC 2.2.0 under Windows and Linux. Now sure what the Martin is using under FreeBSD.

http://www.freepascal.org/mantis/view.php?id=10381

Regards,
- Graeme -

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

Reply by email

Micha Nelissen
to Graeme Geldenhuys
Graeme Geldenhuys wrote
I received a bug report today. I was able to set a read-only property under Linux and Windows without any issues - I didn't notice the property was read-only! The bug report mentions that an compiler

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.

HTH,

Micha

Reply by email

Graeme Geldenhuys
to Micha Nelissen
Micha Nelissen 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/

Reply by email

Jonas Maebe
to Graeme Geldenhuys
Graeme Geldenhuys wrote 12 lines
On 10/12/2007, Micha Nelissen 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...

It has nothing to do with Linux/Windows vs FreeBSD. This was a bug in FPC 2.2.x and below, and is fixed in FPC 2.3.1. It has not been merged because it breaks a lot of (admittedly wrong) code.

Jonas

Reply by email

Graeme Geldenhuys
to Jonas Maebe
Jonas Maebe wrote
It has nothing to do with Linux/Windows vs FreeBSD. This was a bug in FPC 2.2.x and below, and is fixed in FPC 2.3.1. It has not been merged because it breaks a lot of (admittedly wrong) code.

Thank you Jonas. That would explain it, and I'll fix my code appropriately. I normally don't test my software with such a early version of a new compiler. I start doing testing a month or so before a new FPC release.

Regards,
- Graeme -

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

Reply by email