Link to home
Start Free TrialLog in
Avatar of helpme020897
helpme020897

asked on

events ....

Hello,

  here is my problem : i wrote a component based on TCustomPanel.

On the Create methode I wrote: OnResize:=MyProc in order to perform several actions automaticaly when user resizes the component, but this means that developper is unable to write anything on the OnResize event , if he does, the component does not
perform "MyProc".
What i need is that the component should be abble to perform internal method (MyProc) on OnResize
event AND user code
How can i do this ?

Thanks for all ideas



HelpMe
note : points will be upgrades up to 400for a full working answer today
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

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
Avatar of kretzschmar
hi helpme

do not use the on..-handler,
do something like this

type
  TMyPanel = class(TCustomPanel)
  private
    { Private declarations }
  protected
    { Protected declarations }
    Resize; Override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

----

procedure TMyPanel.Resize;
begin
  MySpecialProc;
  inherited;  //calls the onresize-eventhandler
end;

meikl
Avatar of rwilson032697
rwilson032697

..

The override Resize method calls the OnResize event which is why you call the inherited method.

You may want to put the call to your procedure either before or after the call to inherited, depending on the order you want your procedure and the OnResize event to be called.

Cheers,

Raymond.
hi helpme

do not use the on..-handler,
do something like this

type
  TMyPanel = class(TCustomPanel)
  private
    { Private declarations }
  protected
    { Protected declarations }
    Resize; Override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

----

procedure TMyPanel.Resize;
begin
  MySpecialProc;
  inherited;  //calls the onresize-eventhandler
end;

meikl
i hate my new mouse,
sorry for repeated posting

one typo by me
this

  protected
    { Protected declarations }
    Resize; Override;
 
should be

}
  protected
    { Protected declarations }
    Procedure Resize; Override;
 
meikl
hi raymond,
you're a bit faster :-(
meikl ;-)
Hi Meikl :-)
Avatar of helpme020897

ASKER

Adjusted points to 400
Thanks for all of you, ans specials thanks to rwilson for his quick and working answer.

here are the promised points

HelpMe
terrible, one minute :-(

hi raymond,
your are back on place one ;-)
Hi Meikl: Yippee! For how long I wonder :-)
Only some hours, you was 50pts better than barry :-)