Using Notification to track component creation...
From: Raptor (bogus_at_none.com)
Date: 01/28/05
- Next message: Raptor: "Re: Using Notification to track component creation..."
- Previous message: Raptor: "Re: Elementary Qs on objects"
- Next in thread: Raptor: "Re: Using Notification to track component creation..."
- Reply: Raptor: "Re: Using Notification to track component creation..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 Jan 2005 21:04:03 -0800
Again, the objective is for my language management unit/component to be able
to set component captions/hints ON STARTUP, etc., even though the
translating unit/component might be created before some or all the other
components are in existence. Hey, is that asking so much? Heh.
Suggestions so far include:
"But an often used trick is to post a Windows message to yourself. Message
processing
only starts when all forms are created."
++ Not sure how I'd do this, having not used Windows messaging for much more
than creating a mouseover routine and that sort of thing.
"Why would you not register yourself for notification whenever a component
is added or
removed?"
++ Where do I sign up? Heh. (I'm not sure what 'register yourself for
notification" entails.)
"Override the Notification method" in a form descendant or a component.
++ Finding example code required pawing through hundreds of posts, but I
finally cobbled this together JUST FOR TESTING:
On my main form:
TformMain = class(TForm)
stat: TStatusBar;
...
ListDB: TListBox;
procedure FormActivate(Sender: TObject);
...
procedure Notification (aComponent: TComponent; Operation: TOperation);
override;
private
public
aLocalizer: TLocalizer;
end;
procedure TFormMain.Notification (aComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(aComponent, Operation);
if (Operation = opInsert) then
if listDB <> nil then
listDB.Items.add(aComponent.ClassName);
end;
This is doing something, as some classnames are being added to the
list--though obviously not all. But I don't know how I'd actually use it.
Similarly, I figured out (I THINK) how to add code like this to my Localizer
unit/component, though I have no idea how to make use of it. I'm guessing
that Maarten's "register for notification" has something to do with it.
I've made it this far: Where do I go from here? The best solution would be
one which allowed the Localizer component to be self-contained, requiring no
external coding... just dropping the component on the (or ALL, if necessary)
form(s). But I'll take what I can get.
Thank all of you for your ongoing advice and for the stimulating
discussions.
Raptor
- Next message: Raptor: "Re: Using Notification to track component creation..."
- Previous message: Raptor: "Re: Elementary Qs on objects"
- Next in thread: Raptor: "Re: Using Notification to track component creation..."
- Reply: Raptor: "Re: Using Notification to track component creation..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]