Link to home
Start Free TrialLog in
Avatar of AbhiJeet
AbhiJeet

asked on

Delphi inherited method

Hi Experts,

I have a form eg ManagerForm where i have  buttons say refresh and delete. There is an action actionDelete associated with delete button.

There is another form which is visually inherited from this from say form1.

When i click Delete on form1 it goes to the click event in managerform which i have written as below:

procedure TManagerform.Deleteclick(sender : TObject) ;
begin
  actionDelete.Execute;
end;

It executes actionDeleteExecute in child form form1. Now i need to call the click event of refresh button after Delete is executed.

Hence i wrote as:

procedure TManagerform.Deleteclick(sender : TObject) ;
begin
  actionDelete.Execute;
  tbRefreshexecute(sender);
end;

It does not call the tbRefreshexecute method written in the child form, what is wrong in the code?
Avatar of weifai
weifai

Put a breakpoint at tbRefreshexecute and see if it actually stops there. If not, then check the OnClick property of the Delete button.

If stops, then step over tbRefreshexecute manually. If no action is seen, then debug tbRefreshexecute.
Avatar of AbhiJeet

ASKER

It stops but my question was why it is not going to tbrefreshexecute in the child form as it goes for actiondeleteexecute method.
Avatar of ste5an
It depends on your tbrefreshexecute method. Cause as you're invoking it with sender, thus it gets the base forms button. So it does not know about the inherited child form.
SOLUTION
Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial