[lazarus] Howto connect an Onclick-event to an existing procedure?

2007-12-20 Thread John vd Waeter

Hi all,

I have several TUpDown buttons created at runtime.

I have a general event for the onclick:

procedure UpDownClick(Sender:TObject; Button:TUDBtnType)
begin
 ...
 DoMyStuff;
 ...
end;

Now at runtime I like to connect the updown.Onclick to this procedure:

With MyUpdown do
 begin
  Parent:= ...
  Top   := ...
  Left  := ...
  OnClick := UpDownClick;
 end;

But the last assignment gives me an error: Wrong number of parameters 
specified


This works ok in Delphi.

How to connect at runtime? I don't know parameters at designtime...

I am using 0.9.24 and target is WinCE

tia!
John


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Howto connect an Onclick-event to an existing procedure?

2007-12-20 Thread Paul Ishenin

John vd Waeter wrote:

Now at runtime I like to connect the updown.Onclick to this procedure:

With MyUpdown do
 begin
  Parent:= ...
  Top   := ...
  Left  := ...
  OnClick := UpDownClick;
 end;

But the last assignment gives me an error: Wrong number of parameters 
specified


This works ok in Delphi.

How to connect at runtime? I don't know parameters at designtime...

I am using 0.9.24 and target is WinCE

FreePascal supports different modes. In Delphi mode your code will work. 
To turn on delphi mode add directive {$mode delphi} at the begining of 
your unit.


In default FreePascal mode you should write OnClick := @UpDownClick;

Best regards,
Paul Ishenin.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Howto connect an Onclick-event to an existing procedure?

2007-12-20 Thread Michael Van Canneyt


On Thu, 20 Dec 2007, John vd Waeter wrote:

 Hi all,
 
 I have several TUpDown buttons created at runtime.
 
 I have a general event for the onclick:
 
 procedure UpDownClick(Sender:TObject; Button:TUDBtnType)
 begin
  ...
  DoMyStuff;
  ...
 end;
 
 Now at runtime I like to connect the updown.Onclick to this procedure:
 
 With MyUpdown do
  begin
   Parent:= ...
   Top   := ...
   Left  := ...
   OnClick := UpDownClick;

Try changing this to

  OnClick := @UpDownClick;

or replace the mode directive at the top of the unit with delphi mode:
{$mode delphi}

Michael.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Howto connect an Onclick-event to an existing procedure?

2007-12-20 Thread John vd Waeter

Like a charm! Thank you both!

kind regards,
John

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives