Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#4

AW: Frame-Name in Variable

  Alt 24. Aug 2012, 08:29
Vielleicht kannst Du mit folgendem Code etwas anfangen ...
Delphi-Quellcode:
procedure TTemplate.FormCreate(Sender: TObject);
begin

{$IFDEF gentranstab}
    GetTheProps4Trans(Self,Self.Classname,'');
{$ELSE}
  Translate;
{$ENDIF}
end;
Translate s.u., GetTheProps4Trans im Anhang

Delphi-Quellcode:
// Lokalisierung von Properties aus Translate_xx.XML
Procedure SetTranslation(Lang:TDataset;TheForm:TForm);
var
TheComp:TComponent;
CN,CNP:String;
PropInfo: PPropInfo;
V:PPTypeInfo;
cap,Prop:String;
begin

  Lang.Filter := 'FormClassName=' + QuotedStr(TheForm.ClassName) + ' AND not hidden';
  Lang.Filtered := true;
  While not Lang.Eof do
    begin
    try
    TheComp:=TheForm;
    CN:=Lang.FieldByName('ComponentName').asString;
    if Length(CN)>0 then
      begin
        While (Pos('.',CN)>0) and Assigned(TheComp) do
          begin
          CNP:=Copy(CN,1,pos('.',CN)-1);
          CN:=Copy(CN,pos('.',CN)+1,Length(CN));
          if Pos('*',CNP)>0 then TheComp:=TheComp.Components[StrToInt(Copy(CNP,2,Length(CNP)))]
          else TheComp:=TheComp.FindComponent(CNP);
          end;
        if Assigned(TheComp) then
          begin
          if Pos('*',CN)>0 then TheComp:=TheComp.Components[StrToInt(Copy(CN,2,Length(CN)))]
          else TheComp:=TheComp.FindComponent(CN);
          end;
      end;
    IF Assigned(TheComp) then
      begin
        if Lang.FieldByName('IsClassType').asBoolean then
          begin
          PropInfo := GetPropInfo(TheComp,Lang.FieldbyName('Property').Value);
          if Assigned(PropInfo) then
            begin
            try
            if (not (TheComp is TMainMenu)) and (not (TheComp is TPopupMenu)) and (not (TheComp is TPageControl)) then //and ((not ((TheComp is TDBRadioGroup) or (TheComp is TRadioGroup)))) then
            TStrings(GetOrdProp(TheComp,PropInfo)).Text:=Lang.FieldbyName('Content').Value;
            except
              ON E:Exception do MessageDLG( E.Message+#13#10+TheComp.Name + ' - ' + Lang.FieldbyName('Property').Value,mtError,[mbok],0);
            end;
            end;
          end
        else
          begin
          cap:= Lang.FieldbyName('Content').Value;
          Prop:=Lang.FieldbyName('Property').Value;
          SetPropValue(TheComp,prop,cap);
          end;
      end;
    except
     ON E:Exception do MessageDLG( E.Message+#13#10+TheComp.Name + ' - ' + Lang.FieldbyName('Property').Value,mtError,[mbok],0);
    end;
    Lang.Next;
    end;

end;
Angehängte Dateien
Dateityp: pas GenTranslationTable.pas (6,1 KB, 1x aufgerufen)
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat