Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there any thing similar to VFP 'This'
Message
 
To
27/11/2001 22:23:12
General information
Forum:
Delphi
Category:
Coding Syntax & Commands
Miscellaneous
Thread ID:
00585778
Message ID:
00586835
Views:
20
>I created a
>procedure ButtonPress(Sender:TButton);
>begin
> Edit1.Text = Edit1.Text + Sender.Caption;
>end;
>
>in the form and assigned it to click event of all buttons.
>While comiling it gives error that the procedure is not in correct form.
>But if I ignore the message (for 10 times for 10 buttons) everthing works
>fine as expected.

Sender must be TObject in procedure definition.
Try this:

procedure ButtonPress(Sender: TObject);
begin
Edit1.Text := Edit1.Text + (Sender as TButton).Caption;
end;

or
Edit1.Text := Edit1.Text + TButton(Sender).Caption;
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform