Re: Elementary Qs on objects
From: Rob Kennedy (me3_at_privacy.net)
Date: 01/27/05
- Next message: Raptor: "Re: Elementary Qs on objects"
- Previous message: Ekkehard Domning: "Re: Access parallel port via Virtual printer port for USB"
- In reply to: Raptor: "Re: Elementary Qs on objects"
- Next in thread: Raptor: "Re: Elementary Qs on objects"
- Reply: Raptor: "Re: Elementary Qs on objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 Jan 2005 14:51:30 -0600
Raptor wrote:
> Two extra points for using the word "elided," three if you're an American.
> Heh.
Thanks, I think. Not sure whether to feel flattered or patronized.
> How might I best ensure that all components on all forms and in all units
> (including dynamically created) will be created BEFORE the component does
> its scan?
Well, as Marc and Maarten said, you can't really do that. What you can
do instead is have your translator be notified when new objects are
created that need translating.
> The best solution would be one where the component user does not have to
> remember to do This before That or manually place This code in That place.
> Barring that, I'll take what I can get to ensure reliable operation.
You should take a look at Mike Lischke's TThemeManager component. What
it does is subclass its owner -- inserting its own code in place of some
of its owner's routines -- so that it can get notification whenever its
owner gets a new component. It needs this so it can automatically
subclass those new components to add XP-style painting to them; you
would use the same technique to know when new components need translating.
TThemeManager also has a method to manually "collect" a control and
everything it contains. This is useful if the controls got created
before TThemeManager had a chance to insert its hook, or when a control
somehow got created without TThemeManager's knowledge. This serves as a
fallback method in case the automatic collection doesn't work. It
doesn't happen often, and it's pretty easy to detect when collection is
needed: The forms aren't painted right, or they aren't in the right
language.
Bruce mentioned overriding Notification; that's the ideal solution for
when you can be assured that all translatable components will be owned
by descendants of that overridden base class. But that situation is hard
to guarantee when working with an already-established class hierarchy,
like the VCL. TThemeManager inserts its code in the middle of the
hierarchy. It's a hack, but sometimes hacks are necessary.
-- Rob
- Next message: Raptor: "Re: Elementary Qs on objects"
- Previous message: Ekkehard Domning: "Re: Access parallel port via Virtual printer port for USB"
- In reply to: Raptor: "Re: Elementary Qs on objects"
- Next in thread: Raptor: "Re: Elementary Qs on objects"
- Reply: Raptor: "Re: Elementary Qs on objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|