Title: Lost Inherited functionality - forms:
Hi James
 
It sounds like double clicking the OK button reassigns the OnClick event for the button and removes a reference to the action. After fiddling with the button, check the object inspector to make sure its OnClick event is empty.
 
Todd.
 
----- Original Message -----
From: James Low
Sent: Wednesday, May 28, 2003 9:50 AM
Subject: [DUG]: Lost Inherited functionality - forms:

This has bugged me for ages, the list is quiet, so maybe someone can help.

I have a Base form with Buttons attached to an actionlist. In the base class I have a protected declaration as follows:

procedure TFrmEditorAbs.aOKExecute(Sender: TObject);
begin
    Assert(FData <> nil, 'FData not assigned');
    Assert(FDataBuffer <> nil, 'FDataBuffer not assigned');
    FData.Assign(FDataBuffer);
    FData.Dirty := true;
    ModalResult := mrOK;
end;

On the Base forms create I build the actions and link them to the OK button:

    FaOK := TAction.Create(FAL);
    FaOK.ActionList := FAL;
    FaOK.Caption := '&OK';
    FaOK.OnExecute := aOKExecute;
    btnOK.Action := FaOK;

This works fine. If I use Delphis IDE and inherit from this form all goes well and I can override aOKExecute in my descendent forms as required. BUT, it seems (D5) is if double click on the OK button in the descendant form, or generally fiddle around and then try to override the AOKExecute I am stuffed. AOkExecute is lost. The code never gets called. All because at some point I have double clicked said OK button and then removed the references from the code (to restore the code window to its prior pristine state). There must be an easy fix, but I usually revert to copying all my code to a new form ... tedious at best.

Any ideas about how this is fixed?

Thanks ...

Notice of Legal Status and Confidential Information: This electronic mail message and any accompanying attachments may contain information that is privileged and CONFIDENTIAL.  If you are not the intended recipient you are advised that any use, review, dissemination, distribution or reproduction of the information is strictly prohibited and may be unlawful.  If you have received this document in error, please notify the sender immediately and destroy the message.

Reply via email to