Sign in Join

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

Mailing lists / lazarus / 1999-10

FPC Request

27 messages · 7 people ·

Reply by email Subscribe to this list Your subscription

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

Shane Miller

We need this to be OK...

type
Somevariable = type Word;

If we do it in FPC we get
Error: Illegal expression

Can this be added somewhat soon? It would help a ton for compatability...

Thanks
Shane

Reply by email

Shane Miller

Another request.

Classesh.inc should contain 4 const values.

scShift = $2000
scCtrl = $4000;
scAlt = $8000
scNone = 0;

These are used to defiune the TShortCut returned in Menus.pp

Thanks
Shane

Reply by email

Shane Miller

Also, default values for a property or variable in a class is needed.

Property Items[index: integer]: TMark read Get write Put; default;

and

Property Number : Integer read Get write Put; default 0;

have to be accepted.

Shane

Reply by email

Shane Miller

To get around the menu problem (it is a class of TWinControl) I created a TPopupMenu type in Controls.pp and set it to a word so I could still have all the code that deals with TPopupMenu's.

This is a very temporary fix until the menus are fixxed. If you have code that assigns a TPopupmenu or calls it's Create or sets it to NIL then it won't compile because it's not a class, it's a word value.

TMenu class needs to be fixxed.

Shane

Reply by email

Peter Vreman
to Shane Miller: Defining a TYPE as TSomeType = Type Word; creates a type that is not associated with a…
you wrote 25 lines
Defining a TYPE as TSomeType = Type Word; creates a type that is not associated with a Word. For example, if you define some types as type T1 = Word; T2 = Word; TSomeType = type Word; then T1 and T2 are identical to words, but TSomeType is actually a NEW type. Delphi uses this to override the normal property editor in their IDE. If they defined a published property as a T1 and selected it in the object inspector, they would edit it like they would edit a WORD value. If they defined a published property as a TSomeType and tried to edit it in the object inspector, you could create your own property editor for that type. It's NOT associated with a word and therefore can be edited differently. I think for now, you simply need to allow the declaration, and we can work on the other parts of that later.

OK, i'll add support for it as soon as i've finished the linker part rewritting.

Peter

Reply by email

Shane Miller

Thanks Peter.

------------------------------------------------------------ Shane Miller

Get paid to surf the net!
http://alladvantage.com/go.asp?refid=DEX-870

Home page : http://www.lakefield.net/~smiller

Auto-IP Publisher : http://www.lakefield.net/~smiller/autoip

Advanced Clipboard : http://www.lakefield.net/~smiller/advclipboard

Lazarus : http://www.miraclec.com/lazarus
----------------------------------------------------------

Earlier message 45 lines
-----Original Message----- From: Peter Vreman To: Date: Wednesday, October 20, 1999 2:31 PM Subject: RE: [lazarus] FPC Request >At 18:57 20-10-99 , you wrote: >>Defining a TYPE as >> >>TSomeType = Type Word; >> >>creates a type that is not associated with a Word. For example, if you >>define some types as >> >>type >>T1 = Word; >>T2 = Word; >> >>TSomeType = type Word; >> >>then T1 and T2 are identical to words, but TSomeType is actually a NEW >>type. Delphi uses this to override the normal property editor in their >>IDE. If they defined a published property as a T1 and selected it in the >>object inspector, they would edit it like they would edit a WORD value. >> >>If they defined a published property as a TSomeType and tried to edit it >>in the object inspector, you could create your own property editor for >>that type. It's NOT associated with a word and therefore can be edited >>differently. >> >>I think for now, you simply need to allow the declaration, and we can work >>on the other parts of that later. > >OK, i'll add support for it as soon as i've finished the linker part >rewritting. > > >Peter > >_________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.miraclec.com/list_archives/lazarus >

Reply by email

Curtis White
to Shane Miller: We need this to be OK... type Somevariable = type Word; If we do it in FPC we get Error:…

I agree with this. I have hit this problem a few times. Normally, I just change it to

type
Somevariable = Word;

and that seems to work just fine (as far as I can tell with my minimal testing). But it should really be changed in the compiler to be compatible.

Curtis

On 19-Oct-99 Shane Miller wrote 19 lines
We need this to be OK... type Somevariable = type Word; If we do it in FPC we get Error: Illegal expression Can this be added somewhat soon? It would help a ton for compatability... Thanks Shane _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

----------------------------------
Curtis White
Curtis White
http://www.teleport.com/~osiriz/
----------------------------------

Reply by email

Peter Vreman
to Curtis White
Show quoted text 10 lines
> We need this to be OK... > > type > > Somevariable = type Word; > > If we do it in FPC we get > Error: Illegal expression > > Can this be added somewhat soon? It would help a ton for compatability...

If someone can explain what it needs to do, including an example to test it.

Peter

Reply by email

Shane Miller

Defining a TYPE as

TSomeType = Type Word;

creates a type that is not associated with a Word. For example, if you define some types as

type
T1 = Word;
T2 = Word;
TSomeType = type Word;

then T1 and T2 are identical to words, but TSomeType is actually a NEW type. Delphi uses this to override the normal property editor in their IDE. If they defined a published property as a T1 and selected it in the object inspector, they would edit it like they would edit a WORD value.

If they defined a published property as a TSomeType and tried to edit it in the object inspector, you could create your own property editor for that type. It's NOT associated with a word and therefore can be edited differently.

I think for now, you simply need to allow the declaration, and we can work on the other parts of that later.

Shane

Show quoted text 11 lines
>> Peter Vreman 10/20/99 03:40AM >>> > We need this to be OK... > > type > > Somevariable = type Word; > > If we do it in FPC we get > Error: Illegal expression > > Can this be added somewhat soon? It would help a ton for compatability...

If someone can explain what it needs to do, including an example to test it.

Peter

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

Nope. I have a liune like this

Property Items[index: integer]: TMark read Get write Put; default;

and I get

Error: Only one default property is allowed, found inherited default property in class TList;

So, I guess defaults work, but not exactly right yet.

Shane

>> Florian Klaempfl 10/20/99 01:42PM >>>
Show quoted text 11 lines
Also, default values for a property or variable in a class is needed. Property Items[index: integer]: TMark read Get write Put; default; and Property Number : Integer read Get write Put; default 0; have to be accepted.

Should be possible already !!!

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Unknown author
to Shane Miller: Here's another one. When assigning a TNotifyEvent to a procedure like OnCLick :=…
Shane Miller wrote 10 lines
Here's another one. When assigning a TNotifyEvent to a procedure like OnCLick := Button1Click; FPC returns an error Wrong Amout of parameters specified. The way you fix it is to do a OnCLick := @Button1Click;

This is only true if you use -S2. If you use -Sd, it should accept the
OnCLick := Button1Click;
form also. Or, if you use the directives, you should do a

{$mode delphi}

instead of

{$mode objfpc}

Michael.

Reply by email

Shane Miller

Another thing....

In mwedit, Lines is defined as a TSTRINGS.

They can reference each string by doing this
Result := Lines[4];

but FPC throws an error. The way to fix it is to do this:

Result := Lines.Strings[4];

Any reason why this doesn't work? Does it have to do with the "default" declaration that doesn't work that tells the compiler that the property with just a "default" after it's declaration in he class is the default property you would reference when no reference is given?

Understand that?

Shane

Reply by email

Martin Waldenburg
to Shane Miller

Hi!

Show quoted text 17 lines
Another thing.... In mwedit, Lines is defined as a TSTRINGS. They can reference each string by doing this Result := Lines[4]; but FPC throws an error. The way to fix it is to do this: Result := Lines.Strings[4]; Any reason why this doesn't work? Does it have to do with the "default" declaration that doesn't work that tells the compiler that the property with just a "default" after it's declaration in he class is the default property you would reference when no reference is given? Understand that?

Yes. Only one array property can be declared as the default property in Delphi.

Martin

Reply by email

Shane Miller

Oh, another thing.

FPC doesn't allow just

inherited;

You seem to require the procedure name and parameters after the reserved word inherited. This should work without anything but

inherited;

on the line. If you try it, you get an error

identifies no member INHERITED

or something like that.

Shane

Reply by email

Shane Miller

Here's another one. When assigning a TNotifyEvent to a procedure like

OnCLick := Button1Click;

FPC returns an error
Wrong Amout of parameters specified.

The way you fix it is to do a

OnCLick := @Button1Click;

Can you change it so that it allows the first type of assignment? Delphi allows it and it's really making a mess out of the code if I can't do it that way.

thanks
Shane

P.S. - Sorry for being a pest. I hate all the IFDEF's I would have to use otherwise...

Reply by email

Shane Miller

I tried -Sd instead of -S2 and it still didn't work. I sent my code in an email (mwedit code) so take a

You'll have to remove one of the {$IFDEF MWE_FPC} to make it fail.

I do a
ppc386 -S2 mwcustomedit.pas
or a
ppc386 -Sd mwcustomedit.pas
and get the same error.

Somewhere around line 896 is a {$IFDEF} you can remove..

Shane

>> 10/22/99 03:11PM >>>
Shane Miller wrote 10 lines
Here's another one. When assigning a TNotifyEvent to a procedure like OnCLick := Button1Click; FPC returns an error Wrong Amout of parameters specified. The way you fix it is to do a OnCLick := @Button1Click;

This is only true if you use -S2. If you use -Sd, it should accept the
OnCLick := Button1Click;
form also. Or, if you use the directives, you should do a

{$mode delphi}

instead of

{$mode objfpc}

Michael.

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Florian Klaempfl
to Shane Miller: Oh, another thing. FPC doesn't allow just inherited; You seem to require the procedure…
Marc Weustink wrote 28 lines
At 21:01 23-10-99 +0200, Florian Klaempfl wrote: >Shane Miller schrieb: >> >> Oh, another thing. >> >> FPC doesn't allow just >> >> inherited; >> >> You seem to require the procedure name and parameters after the reserved >> word inherited. This should work without anything but >> >> inherited; >> >> on the line. If you try it, you get an error >> >> identifies no member INHERITED >> >> or something like that. >> >> Shane > >I think this should work only in message handlers, but even there it doesn't >work. In delphi it works in every overidden method

What are the rules for paramter passing?

Reply by email

Florian Klaempfl
to Shane Miller: Another request: Delphi allows you to assign a Pointer variable to a TObject by doing the…
Shane Miller wrote 17 lines
Another request: Delphi allows you to assign a Pointer variable to a TObject by doing the conversion for you, so you don't need to typecast it. For example Var P: Pointer; T: TObject; Begin P := T; End; FPC makes you typecast T as a Pointer.

No problem here!

Show quoted text 8 lines
Also, the other way around should work too. T := P; so I don't need to typecast P as a TObject. Could this be done?

Hmmm, I don't know if this should done! It seems to be dangerous. If someone wants to assign a pointer to tobject, he should know what he do and type cast it!

Reply by email

Florian Klaempfl
to Shane Miller: Oh, another thing. FPC doesn't allow just inherited; You seem to require the procedure…
Show quoted text 18 lines
Oh, another thing. FPC doesn't allow just inherited; You seem to require the procedure name and parameters after the reserved word inherited. This should work without anything but inherited; on the line. If you try it, you get an error identifies no member INHERITED or something like that. Shane

I think this should work only in message handlers, but even there it doesn't work.

Reply by email

Marc Weustink
to Shane Miller: Oh, another thing. FPC doesn't allow just inherited; You seem to require the procedure…
Florian Klaempfl wrote
Marc Weustink wrote: > > At 21:01 23-10-99 +0200, Florian Klaempfl wrote: > >Shane Miller schrieb:

[Single inherited usage in overidden methods]

> > > >I think this should work only in message handlers, but even there it

doesn't

Show quoted text 6 lines
> >work. > > In delphi it works in every overidden method > What are the rules for paramter passing?

If you have something like:

  MyClass = class
  public
    procedure MyMethod(Param1, Param2: Integer); virtual;
  end;
  MyOtherClass = class(MyClass)
  public
    procedure MyMethod(Param1, Param2: Integer); override;
  end;

you can use inherited like:

  procedure MyOtherClass.MyMethod(Param1, Param2: Integer);
  begin
    inherited;
  end;

or like:

  procedure MyOtherClass.MyMethod(Param1, Param2: Integer);
  begin
    inherited MyMethod(Param1, Param2);
  end;

Both are the same. Delphi nows that MyClass.MyMethod needs 2 params, and passes them to the inherited method.

Marc

Reply by email

Shane Miller

I request that because Delphi allows it..

Shane

>> Florian Klaempfl 10/25/99 03:04PM >>>
Shane Miller wrote 17 lines
Another request: Delphi allows you to assign a Pointer variable to a TObject by doing the conversion for you, so you don't need to typecast it. For example Var P: Pointer; T: TObject; Begin P := T; End; FPC makes you typecast T as a Pointer.

No problem here!

Show quoted text 8 lines
Also, the other way around should work too. T := P; so I don't need to typecast P as a TObject. Could this be done?

Hmmm, I don't know if this should done! It seems to be dangerous. If someone wants to assign a pointer to tobject, he should know what he do and type cast it!

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

Actually, this DOES compiler in Delphi, but not FPC.

Shane

>> Martin Waldenburg 10/23/99 02:12AM >>>

Hi!

Show quoted text 17 lines
Another thing.... In mwedit, Lines is defined as a TSTRINGS. They can reference each string by doing this Result := Lines[4]; but FPC throws an error. The way to fix it is to do this: Result := Lines.Strings[4]; Any reason why this doesn't work? Does it have to do with the "default" declaration that doesn't work that tells the compiler that the property with just a "default" after it's declaration in he class is the default property you would reference when no reference is given? Understand that?

Yes. Only one array property can be declared as the default property in Delphi.

Martin

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Marc Weustink
to Shane Miller: Oh, another thing. FPC doesn't allow just inherited; You seem to require the procedure…
Florian Klaempfl wrote 23 lines
Shane Miller schrieb: > > Oh, another thing. > > FPC doesn't allow just > > inherited; > > You seem to require the procedure name and parameters after the reserved > word inherited. This should work without anything but > > inherited; > > on the line. If you try it, you get an error > > identifies no member INHERITED > > or something like that. > > Shane I think this should work only in message handlers, but even there it doesn't work.

In delphi it works in every overidden method

Marc

Reply by email

Shane Miller

I must say that the 2 requests I really need fixed is to allow the statement

inherited;

to compile and 2nd would be why this compiles in Delphi but not FPC

var
Something : TStrings
Str := Something[I];
Why do I have to do this under linux
Str := Something.Strings[I];

??????

Shane

>> "Shane Miller" 10/25/99 01:40PM >>>

Another request:

Delphi allows you to assign a Pointer variable to a TObject by doing the conversion for you, so you don't need to typecast it. For example

Var
P: Pointer;
T: TObject;
Begin
P := T;
End;

FPC makes you typecast T as a Pointer.

Also, the other way around should work too.

T := P;

so I don't need to typecast P as a TObject.

Could this be done?

Shane

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

Another request:

Delphi allows you to assign a Pointer variable to a TObject by doing the conversion for you, so you don't need to typecast it. For example

Var
P: Pointer;
T: TObject;
Begin
P := T;
End;

FPC makes you typecast T as a Pointer.

Also, the other way around should work too.

T := P;

so I don't need to typecast P as a TObject.

Could this be done?

Shane

Reply by email