This should be possible with the following hook:
procedure TypInfoSetStrProp(Instance: TObject;
PropInfo: PPropInfo;
const Value: string);
var
j: Integer;
cm: TClassMode;
ignore: Boolean;
begin
HookSetStrProp.Reset;
ignore := False;
for j := 0 to
DefaultInstance.TP_GlobalClassHandling.Count - 1 do
begin
cm :=
TClassMode(DefaultInstance.TP_GlobalClassHandling.Items[j]);
ignore := Instance.InheritsFrom(cm.HClass) and
((cm.PropertiesToIgnore.Count = 0) or
(cm.PropertiesToIgnore.IndexOf(PropInfo^.Name) > -1));
if ignore then
Break;
end;
if ignore then
TypInfo.SetStrProp(Instance, PropInfo, Value)
else
TypInfo.SetStrProp(Instance, PropInfo, _(Value));
HookSetStrProp.Enable;
end;
It remains fast.
A corresponding WideString hook is also needed for those
with Unicode enabled VCL.
> Delphi 5 differs a lot from Delphi 6 and 7 with
regard to the
TypInfo
> unit, and Delphi 8 might differ, too. But if it works
perfectly
I think you're correct. The proposed hook is D6/D7
specific. :-/
Logged In: YES
user_id=116253
Pros:
o a combobox' ItemIndex is not affected. No need to
safeguard a combobox
at runtime anymore.
o frames... what about them? They just work. <shrug>
o speeeeeed... :)
o no need to worry about references to other components
(on same or other
form)
o or abstract class references or whatever
Cons:
o I see no easy way of switching language runtime (this is
of no priority
to us here, but YMMV)
o Might be difficult/impossible to support D5 (or even D6)
-- we haven't
looked at this at all.
Logged In: YES
user_id=116253
As things look right now, I need to think a little about
Delphi for .net, too - therefore I postpone this one for now.