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
helpme020897Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
You need to override the resize event, like this:

type
  TMyCustomPanel = class(TCustomPanel)
    protected
      Procedure Resize; Override;
  end;

procedure TMyCustomPanel.Resize;
begin
  Inherited;
  //Do Your stuff here
end;

Cheers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kretzschmarCommented:
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
0
rwilson032697Commented:
..

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.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

kretzschmarCommented:
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
0
kretzschmarCommented:
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
0
kretzschmarCommented:
hi raymond,
you're a bit faster :-(
meikl ;-)
0
rwilson032697Commented:
Hi Meikl :-)
0
helpme020897Author Commented:
Adjusted points to 400
0
helpme020897Author Commented:
Thanks for all of you, ans specials thanks to rwilson for his quick and working answer.

here are the promised points

HelpMe
0
kretzschmarCommented:
terrible, one minute :-(

hi raymond,
your are back on place one ;-)
0
rwilson032697Commented:
Hi Meikl: Yippee! For how long I wonder :-)
0
kretzschmarCommented:
Only some hours, you was 50pts better than barry :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.