Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Probleme mit vaList und vaCollection (https://www.delphipraxis.net/86625-probleme-mit-valist-und-vacollection.html)

Prototypjack 16. Feb 2007 13:45


Probleme mit vaList und vaCollection
 
Moin!

Wie manch einer vielleicht schon weiss, schreibe ich seit Montag an einem Multilingual System. Mittlerweile steht bereits ein voll funktionsfähiger Prototyp alles was noch fehlt ist die Unterstützung von den Typen vaList (TStrings z.B.) und vaCollection (Die Columns bei einem Listview z.B.).

Ich komme an die Daten so heran wie sie in der DFM Datei stehen, also Plaintext. Die Frage ist jetzt:
Wie bekomme ich genannte Daten zur Laufzeit per RTTI (oder auch anders, wenn ihr irgendeine andere Methode kennt) in die entsprechende Eigenschaft einer Komponente?

Ich denke es hilft nicht viel, aber hier mal meine bisherige Methode zum setzen normaler Strings.

Delphi-Quellcode:
function TLanguage.SetPropertyW(AInstance: TComponent; APropertyName: WideString;
  APropertyValue: WideString): Boolean;
var
  lProperty: WideString;
  lSubPropertys: WideString;
  lComponentWProps: TComponent;
begin
  Result := False;
  lSubPropertys := '';
  lProperty := APropertyName;
  // Get the pure property name
  while Pos('.', lProperty) <> 0 do
  begin
    lSubPropertys := lSubPropertys + Copy(lProperty, 1, Pos('.', lProperty));
    Delete(lProperty, 1, Pos('.', lProperty));
  end;

  // Get the right property/component
  lComponentWProps := AInstance;
  if Assigned(lComponentWProps) then
  begin
    while lSubPropertys <> '' do
    begin
      lComponentWProps := TComponent(GetObjectProp(lComponentWProps,
        Copy(lSubPropertys, 1, Pos('.', lSubPropertys) - 1)));
      Delete(lSubPropertys, 1, Pos('.', lSubPropertys));
    end;
  end;

  // Now set the property
  if Assigned(lComponentWProps) then
  begin
    if IsPublishedProp(lComponentWProps, lProperty) then
    begin
      SetWideStrProp(lComponentWProps, lProperty, APropertyValue);
      Result := True;
    end;
  end;
end;
Ich hoffe, dass mir jemand helfen kann
Gruß,
Max


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:12 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz