Sign in Join

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

Mailing lists / lazarus / 2008-07

Incompatible types for OnChange?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Friebe

I noticed something, which I can't explain. Here is the question

in ide/editoroptions is procedure:
    procedure GeneralCheckBoxOnChange(Sender: TObject; Index: integer);

This is assigned (via the Resources of the form) to the TCheckBoxes on the editor-option's color page. ("TextBoldCheckBox").

I understand that it compiles, since the compiler does include resource as they are. BUT it also executes? So on change calls a method with a signature different from what it should expect?
How does that work?

Best Regards
Martin

Reply by email

Marc Weustink
to Martin Friebe
Martin Friebe wrote 12 lines
I noticed something, which I can't explain. Here is the question in ide/editoroptions is procedure: procedure GeneralCheckBoxOnChange(Sender: TObject; Index: integer); This is assigned (via the Resources of the form) to the TCheckBoxes on the editor-option's color page. ("TextBoldCheckBox"). I understand that it compiles, since the compiler does include resource as they are. BUT it also executes? So on change calls a method with a signature different from what it should expect? How does that work?

My guess: The params are passed in a register, so no stack cleanup needed and thus no corruption.

Marc

Reply by email

Mattias Gaertner
to Marc Weustink
Show quoted text 17 lines
Martin Friebe wrote: > I noticed something, which I can't explain. Here is the question > > in ide/editoroptions is procedure: > procedure GeneralCheckBoxOnChange(Sender: TObject; Index: > integer); > > This is assigned (via the Resources of the form) to the TCheckBoxes > on the editor-option's color page. ("TextBoldCheckBox"). > > I understand that it compiles, since the compiler does include > resource as they are. BUT it also executes? So on change calls a > method with a signature different from what it should expect? > How does that work? My guess: The params are passed in a register, so no stack cleanup needed and thus no corruption.

Yes, this trick works for years and was used by the IDE for designer events till 0.9.24.

The GeneralCheckBoxOnChange was probably introduced when the editor options were converted to lfm.
Fixed. This also fixed the gutter/smart tabs bug.

Mattias

Reply by email