[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

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
0
helpme020897
Asked:
helpme020897
  • 6
  • 4
  • 2
1 Solution
 
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
 
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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now