Advertisement

05.12.2008 at 06:45AM PDT, ID: 23394489
[x]
Attachment Details

Delphi 7 :: Component Development - Events without overriding

Asked by Marius0188 in Delphi Components, Delphi Programming, Delphi Programming Language

Hi Experts,

I am building a custom combobox component.
This component, by design, should execute internal code on the onchange event.
It is working 100% but the problem is when you assign a new onchange event in designtime or runtime
it does not execute the code in the component, which makes 100% sense but I need it to always execute
the onchange event in the design of the component.

What I basically did was create a procedure in in the Constructor of the component I assigned the onchange event to this procedure, see code snipped.

But like I mentioned, the developer / user can simply assign a new OnChange event which will just kick mine and that should NOT happen. Mine should always execute and if the developer / user has assigned a onchange then that one too.

Thanks.

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
constructor TComboboxDateFilter.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Parent := TWinControl(AOwner);
 
  Style := csDropDownList;
  Items.Add('Item 1');
  Items.Add('Item 2');
  ItemIndex := 0;
 
  OnChange := Change; //This is the assignment of the OnChange event
end;
[+][-]05.12.2008 at 06:58AM PDT, ID: 21547012

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:02AM PDT, ID: 21547033

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Delphi Components, Delphi Programming, Delphi Programming Language
Sign Up Now!
Solution Provided By: ziolko
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.12.2008 at 07:03AM PDT, ID: 21547039

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:07AM PDT, ID: 21547085

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:10AM PDT, ID: 21547103

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:12AM PDT, ID: 21547120

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:28AM PDT, ID: 21547277

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628