Acro Multi-Language Class-Method for TNT

 

unit TntClassMethod;
interface
uses
  AcroMultiClassMethod,tntClasses,Graphics,tntComCtrls;

  procedure Proc_TtntActionList(ATable:IDataLocate;AComponent:TObject;
    ACodePage,ASeqNo:
string ;AFont:TFont);
  procedure Replace_TtntListView_Columns(AView:TtntCustomListView;
    ATable:IDataLocate;ACodePage,ASeqNo:
string );
  procedure Replace_TtntListView_Items(AView:TtntCustomListView;
    ATable:IDataLocate;ACodePage,ASeqNo:
string );

implementation

uses
  tntStdctrls,tntExtCtrls,tntControls,Menus,tntMenus,tntActnList,tntButtons,tntForms;

... {Class-Method}

procedure Replace_TtntListView_Columns(AView:TtntCustomListView;
  ATable:IDataLocate;ACodePage,ASeqNo:
string );
var
  i:integer;
  LV:TtntListView;
begin
  LV:
= TtntListView(AView);
  LV.Columns.BeginUpdate;
  
try
    
for  i: = 0  to LV.Columns.Count - 1   do
    begin
      LV.Columns[i].Caption:
= GetDisplayValue(ATable,LV.Columns[i].Caption,
        ACodePage,ASeqNo);
    end;
  
finally
    LV.Columns.EndUpdate;
  end;
end;

procedure Replace_TtntListView_Items(AView:TtntCustomListView;
  ATable:IDataLocate;ACodePage,ASeqNo:
string );
var
  i,j:integer;
  LV:TtntListView;
begin
  LV:
= TtntListView(AView);
  LV.Items.BeginUpdate;
  
try
    
for  i: = 0  to LV.Items.Count - 1   do
    begin
      LV.Items[i].Caption:
= GetDisplayValue(ATable,LV.Items[i].Caption,
        ACodePage,ASeqNo);
      
for  j: = 0  to LV.Items[i].SubItems.Count - 1   do
       LV.Items[i].SubItems[j]:
= GetDisplayValue(ATable,LV.Items[i].SubItems[j],
         ACodePage,ASeqNo);
    end;
  
finally
    LV.Items.EndUpdate;
  end;
end;

procedure Proc_TtntMenuItem(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
  procedure ChangeAMenuItem(AMI:TtntMenuItem);
  var
    i:integer;
  begin
    AMI.Caption:
= GetDisplayValue(ATable,AMI.Caption,ACodePage,ASeqNo);
    AMI.Hint:
= GetDisplayValue(ATable,AMI.Hint,ACodePage,ASeqNo);
    
for  i: = 0  to AMI.Count - 1   do
    begin
      ChangeAMenuItem(TtntMenuItem(AMI[i]));
    end;
  end;
begin
  ChangeAMenuItem(TtntMenuItem(AComponent));
end;

procedure Proc_TtntTabControl(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
begin
  
for  i: = 0  to TtntTabControl(AComponent).Tabs.Count - 1   do
  begin
    TtntTabControl(AComponent).Tabs[i]:
= GetDisplayValue(ATable,TtntTabControl(AComponent).Tabs[i],ACodePage,ASeqNo);
  end;
end;

procedure Proc_TtntTreeView(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
  ANode:TtntTreeNode;
begin
  TtntTreeView(AComponent).Items.BeginUpdate;
  
try
    
for  i: = 0  tO TtntTreeView(AComponent).Items.Count - 1   do
    begin
      ANode:
= TtntTreeView(AComponent).Items[i];
      ANode.Text:
= GetDisplayValue(ATable,ANode.Text,ACodePage,ASeqNo);
    end;
  
finally
    TtntTreeView(AComponent).Items.EndUpdate;
  end;
end;

procedure Proc_TtntListView(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i,j:integer;
  LV:TtntListView;
begin
  LV:
= TtntListView(AComponent);
  LV.Columns.BeginUpdate;
  LV.Items.BeginUpdate;
  
try
    
for  i: = 0  to LV.Columns.Count - 1   do
    begin
      LV.Columns[i].Caption:
= GetDisplayValue(ATable,LV.Columns[i].Caption,
        ACodePage,ASeqNo);
    end;
    
for  i: = 0  to LV.Items.Count - 1   do
    begin
      LV.Items[i].Caption:
= GetDisplayValue(ATable,LV.Items[i].Caption,
        ACodePage,ASeqNo);
      
for  j: = 0  to LV.Items[i].SubItems.Count - 1   do
       LV.Items[i].SubItems[j]:
= GetDisplayValue(ATable,LV.Items[i].SubItems[j],
         ACodePage,ASeqNo);
    end;
  
finally
    LV.Items.EndUpdate;
    LV.Columns.EndUpdate;
  end;
end;

procedure Proc_TtntComboBox(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i,Index:integer;
  vIsSorted:Boolean;
begin
  TtntComboBox(AComponent).Items.BeginUpdate;
  
try
    Index:
= TtntComboBox(AComponent).ItemIndex;
    vIsSorted:
= false ;
    
if  TtntComboBox(AComponent).Items  is  TtntStringList then
    begin
      vIsSorted:
= TtntStringList(TtntComboBox(AComponent).Items).Sorted;
      TtntStringList(TtntComboBox(AComponent).Items).Sorted:
= false ;
    end;
    
for  i: = 0  to TtntComboBox(AComponent).Items.Count - 1   do
      TtntComboBox(AComponent).Items[i]:
=
        GetDisplayValue(ATable,TtntComboBox(AComponent).Items[i],ACodePage,ASeqNo);
    TtntComboBox(AComponent).ItemIndex:
= Index;
    
if  TtntComboBox(AComponent).Items  is  TtntStringList then
      TtntStringList(TtntComboBox(AComponent).Items).Sorted:
= vIsSorted;
  
finally
    TtntComboBox(AComponent).Items.EndUpdate;
  end;
end;

procedure Proc_TtntStatusBar(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
begin
  TtntStatusBar(AComponent).Panels.BeginUpdate;
  
try
    
for  i: = 0  to TtntStatusBar(AComponent).Panels.Count - 1   do
    begin
      TtntStatusBar(AComponent).Panels[i].Text:
= GetDisplayValue(ATable,
        TtntStatusBar(AComponent).Panels[i].Text,ACodePage,ASeqNo);
    end;
  
finally
    TtntStatusBar(AComponent).Panels.EndUpdate;
  end;
end;

procedure Proc_TtntListBox(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i,Index:integer;
begin
  TtntListBox(AComponent).Items.BeginUpdate;
  
try
    index:
= TtntListBox(AComponent).ItemIndex;
    
for  i: = 0  to TtntListBox(AComponent).Items.Count - 1   do
      TtntListBox(AComponent).Items[i]:
=
        GetDisplayValue(ATable,TtntListBox(AComponent).Items[i],ACodePage,ASeqNo);
    TtntListBox(AComponent).ItemIndex:
= Index;
  
finally
    TtntListBox(AComponent).Items.EndUpdate;
  end;
end;

procedure Proc_TtntActionList(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
  ACA:TtntAction;
begin
  
for  i: = 0  to TtntActionList(AComponent).ActionCount - 1   do
  begin
    
if  TtntActionList(AComponent).Actions[i]  is  TtntAction then
    begin
      ACA:
= TtntAction(TtntActionList(AComponent).Actions[i]);
      ACA.Caption:
= GetDisplayValue(ATable,ACA.Caption,ACodePage,ASeqNo);
      ACA.Hint:
= GetDisplayValue(ATable,ACA.Hint,ACodePage,ASeqNo);
    end;
  end;
end;

procedure Proc_TtntPanel(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntPanel(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntPanel(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntGroupBox(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntGroupBox(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntGroupBox(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntPageControl(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
begin          
  
for  i: = 0  to TtntPageControl(AComponent).PageCount - 1   do
    TtntPageControl(AComponent).Pages[i].Caption:
=
      GetDisplayValue(ATable,TtntPageControl(AComponent).Pages[i].Caption,
        ACodePage,ASeqNo);
end;

procedure Proc_TtntButton(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntButton(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntButton(AComponent).Caption,
      ACodePage,ASeqNo);
end;

procedure Proc_TtntLabel(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntLabel(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntLabel(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntSpeedButton(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntSpeedButton(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntSpeedButton(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntBitbtn(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntBitbtn(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntBitbtn(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntToolBar(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
begin
  TtntToolBar(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntToolBar(AComponent).Caption,ACodePage,ASeqNo);
  
for  i: = 0  to TtntToolBar(AComponent).ButtonCount - 1   do
    TtntToolBar(AComponent).Buttons[i].Caption:
=
      GetDisplayValue(ATable,TtntToolBar(AComponent).Buttons[i].Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntForm(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin           
  TtntForm(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntForm(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntStaticText(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntStaticText(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntStaticText(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntRadioButton(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntRadioButton(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntRadioButton(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntCheckBox(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
begin
  TtntCheckBox(AComponent).Caption:
=
    GetDisplayValue(ATable,TtntCheckBox(AComponent).Caption,ACodePage,ASeqNo);
end;

procedure Proc_TtntRadioGroup(ATable:IDataLocate;AComponent:TObject;
  ACodePage,ASeqNo:
string ;AFont:TFont);
var
  i:integer;
begin
  TtntRadioGroup(AComponent).Items.BeginUpdate;
  
try
    TtntRadioGroup(AComponent).Caption:
=
      GetDisplayValue(ATable,TtntRadioGroup(AComponent).Caption,ACodePage,ASeqNo);
    
for  i: = 0  to TtntRadioGroup(AComponent).Items.Count - 1   do
    begin
      TtntRadioGroup(AComponent).Items[i]:
=
        GetDisplayValue(ATable,TtntRadioGroup(AComponent).Items[i],ACodePage,ASeqNo);
    end;
  
finally
    TtntRadioGroup(AComponent).Items.EndUpdate;
  end;
end;

initialization
  AcroClassMethodStorage.RegisterClassMethod(TtntPanel         ,Proc_TtntPanel);
  AcroClassMethodStorage.RegisterClassMethod(TtntGroupBox      ,Proc_TtntGroupBox);
  AcroClassMethodStorage.RegisterClassMethod(TtntStaticText    ,Proc_TtntStaticText);
  AcroClassMethodStorage.RegisterClassMethod(TtntTabControl    ,Proc_TtntTabControl);
  AcroClassMethodStorage.RegisterClassMethod(TtntPageControl   ,Proc_TtntPageControl);
  AcroClassMethodStorage.RegisterClassMethod(TtntButton        ,Proc_TtntButton);
  AcroClassMethodStorage.RegisterClassMethod(TtntSpeedButton   ,Proc_TtntSpeedButton);
  AcroClassMethodStorage.RegisterClassMethod(TtntBitbtn        ,Proc_TtntBitbtn);
  AcroClassMethodStorage.RegisterClassMethod(TtntComboBox      ,Proc_TtntComboBox);
  AcroClassMethodStorage.RegisterClassMethod(TtntTreeView      ,Proc_TtntTreeView);
  AcroClassMethodStorage.RegisterClassMethod(TtntListView      ,Proc_TtntListView);
  AcroClassMethodStorage.RegisterClassMethod(TtntListBox       ,Proc_TtntListBox);
  AcroClassMethodStorage.RegisterClassMethod(TtntStatusBar     ,Proc_TtntStatusBar);
  AcroClassMethodStorage.RegisterClassMethod(TtntLabel         ,Proc_TtntLabel);
  AcroClassMethodStorage.RegisterClassMethod(TtntToolBar       ,Proc_TtntToolBar);
  AcroClassMethodStorage.RegisterClassMethod(TtntForm          ,Proc_TtntForm);
  AcroClassMethodStorage.RegisterClassMethod(TtntMenuItem      ,Proc_TtntMenuItem);
  AcroClassMethodStorage.RegisterClassMethod(TtntRadioButton   ,Proc_TtntRadioButton);
  AcroClassMethodStorage.RegisterClassMethod(TtntRadioGroup    ,Proc_TtntRadioGroup);
  AcroClassMethodStorage.RegisterClassMethod(TtntCheckBox      ,Proc_TtntCheckBox);
finalization
  AcroClassMethodStorage.UnRegisterClassMethod(TtntPanel);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntGroupBox);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntStaticText);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntTabControl);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntPageControl);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntButton);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntSpeedButton);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntBitbtn);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntComboBox);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntTreeView);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntListView);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntListBox);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntStatusBar);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntLabel);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntToolBar);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntForm);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntMenuItem);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntRadioButton);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntRadioGroup);
  AcroClassMethodStorage.UnRegisterClassMethod(TtntCheckBox);
end.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

火星牛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值