events on a TppLabel desendent
Hallo
I have (would like) to add 2 private events to my custome component.
1: onDblClick := show default property editor.
2: OnTextChanged := Set my Translated property to false.
These are not events that the user can use but would make my life a lot
easier. I tried copieng the regular TControl OnDoubleClick but did not
get it to work at all.
Do you have some sample of how I can do this, that is if it is posible.
Thanks,
Walter
CPI AG
I have (would like) to add 2 private events to my custome component.
1: onDblClick := show default property editor.
2: OnTextChanged := Set my Translated property to false.
These are not events that the user can use but would make my life a lot
easier. I tried copieng the regular TControl OnDoubleClick but did not
get it to work at all.
Do you have some sample of how I can do this, that is if it is posible.
Thanks,
Walter
CPI AG
This discussion has been closed.
Comments
method directly. An event property allows communication between two objects
at rutime so that when one has some action that takes place and it wants to
notify a single listener, it can call a method in the listnening object
through the method pointer.
I'm gonna guess that you have a popup menu and want to listed for changes in
it. You need two private event handlers I imagine. What are the event types
that you need handlers for? You need to check the signature of the event
type to see what the handler should look like. For example, TNotifyEvent has
Sender: TObject as a single parameter, and so any event handler that is
connected to it has to match that signature so that it can be assigned.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
editor just like in delphi design. You can't. Event aren't transmited from
the designer to the report components.
The only way out is to add an item in the popup menu that would call the
property editor.
--
Daniel Lemire
Programmeur,
Conception Design Ware Inc.
Tél.: 819-868-8853
Fax : 819-868-8855
Can I react on a double-click on the component ad designtime, if so how.
Walter
is created in the designer. However, since method pointers only support one
method, then you will lose any event handlers that were previously assigned
by the code internal to the designer. The following code does work.
However, a better alternative would be to hook into the Windows messaging to
listen for the mouse double click on the design control.
uses
ppDsgnCt;
procedure TForm1.Button1Click(Sender: TObject);
begin
ppDesigner1.ShowModal;
end;
procedure TForm1.ppDesigner1Show(Sender: TObject);
begin
if (ppLabel1.DesignControl <> nil) then
ppLabel1.DesignControl.OnDblClick := DoubleClickHandler;
end;
procedure TForm1.DoubleClickHandler(Sender: TObject);
begin
Beep;
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
the DesignControl as shown in the code below.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Can one hook into the Windows messaging system?
walter
http://delphi.about.com/library/bluc/text/uc063001a.htm
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
The InstantiateDesignControl is called again but not the FreeDesignControl. So the events are
linked back to my own event methods.
So here's what I did in the InstantiateDesignControl:
if not Assigned(fMyDblClick) then
begin
fMyDblClick := DesignControl.OnDblClick;
DesignControl.OnDblClick := MyDblClick;
end;
Any idea why the InstantiateDesignControl is called without the FreeDesignControl?
Is this normal behavior and I didn't understand the designcontrol workings correctly?
--
Daniel Lemire