Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread How to assign a procedure to the OnClick event of a panel
Wed, Sep 4 2013 6:43 AMPermanent Link

Franck - Midi pyrénées - France

Esteves Ducilia

Avatar

Hello there,

I would like to create somes panels at runtime and assign a procedure to the event Onclick.
I have the message [Error] unitMain.wbs (101,35): The menuPanelClick(menuPanel) method is not a class method
thank for your help

procedure creMenuPanel(str : string) ;
var menuPanel : TPanel ;
begin
  menuPanel := TPanel.create(mainForm.panelLeft) ;
  menuPanel.color := clForestGreen ;
  menuPanel.Height := 50 ;
  menuPanel.Width  := 100 ;
  menuPanel.Visible := true ;
  menuPanel.EnableDrag : = true ;
  menuPanel.OnClick := TmainForm.menuPanelClick(menuPanel));
end ;

procedure TmainForm.menuPanelClick(Sender: TObject);
begin
  ShowMessage('me') ;
end;
Wed, Sep 4 2013 8:00 AMPermanent Link

Franck - Midi pyrénées - France

Esteves Ducilia

Avatar

No need an answer . I have found the solution. Thank
Image