ini dosyası kullanımı hk

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
master_20
Üye
Mesajlar: 85
Kayıt: 27 Eki 2010 09:42

ini dosyası kullanımı hk

Mesaj gönderen master_20 »

Merhaba arkadaşlar, form üzerinde yaklaşık 30 labelim var ve bunların captionları çalışma esnasında kullanıcı tarafından değiştirilebiliyor. sorunum şu ki kullanıcı bu captionları değiştirdikten sonra programı kapatıp tekrar açtığında, artık labellerin captionları kullanıcnın verdiği yeni captionlar olması gerekiyor . bunun için ini dosyasını kullandm for ile de tüm labellere ulaştım ama ini dosyasını kontrol ettiğimde sadece tek satır var ve sadece en son labelin captionunu yazıyor :s nette ve forumda araştrıdım ama hep kısa örneklerle tek bir edit.in özelliklerinin kaydedilmesi gösterilmiş. bu konuda yardımcı olabilecek var mı ?
Kullanıcı avatarı
Battosai
Üye
Mesajlar: 1316
Kayıt: 01 Eki 2007 12:02
Konum: Ankara

Re: ini dosyası kullanımı hk

Mesaj gönderen Battosai »

söyle bir kayıt kodu işini görür....

Kod: Tümünü seç

var
ini:Tstringlist;
S:string;
i:integer;
Begin
 try
   S:='[title]';
    ini:=Tstringlist.create;
  with Form1 do begin
    for  i:= 0 to component.count-1 do 
        Begin
             if component[i] is Tlabel then 
               S:=S+#10#13+Tlabel(components[i]).name+'='+ Tlabel(components[i]).caption;
        End; 
  end;
  ini.add(S);
 ini.savetofile('C:\labels.ini');
 finally;
  ini.free;
 end;
End;
master_20
Üye
Mesajlar: 85
Kayıt: 27 Eki 2010 09:42

Re: ini dosyası kullanımı hk

Mesaj gönderen master_20 »

hocam peki bunun okuması nasl olur :D
Kullanıcı avatarı
adelphiforumz
Üye
Mesajlar: 602
Kayıt: 01 Nis 2008 05:38
Konum: İstanbul

Re: ini dosyası kullanımı hk

Mesaj gönderen adelphiforumz »

S.A.

daha önceden kullandığım bir alt rutinin bazı yerlerini kesip paylaşmaya çalıştım
fakat eksik yerler olabilir. biraz toparlarsan işini görecektir.
Bu kod caption ve hintlerin bir ini dosyasına yazılmasını ve program tekrardan açılınca ekrana gelmesini sağlıyordu.

projenin ilk başında a ini file olarak kullanacağın ini dosyasını açarsan işini görecektir.
a:=TIniFile.Create("C:\deneme.ini");
a.UpdateFile;

Kod: Tümünü seç

procedure TForm1.FormCreate(Sender: TObject);
begin
  Form:=(Sender As TForm);
  FormComponentCaptionAndHint((Sender As TForm));
end;

Kod: Tümünü seç

procedure TForm1.FormActivate(Sender: TObject);
begin
  FormCaptionAndName((Sender As TForm));
end;

Kod: Tümünü seç

unit DIL_AYARLARI;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, Db, ADODB, ComCtrls, Registry, ExtCtrls, IniFiles, Buttons,StdCtrls,DbCtrls,DbGrids,Checklst;
var
  a:TIniFile;
  AForm,Form:TForm;
  FormName:String;
  FormCaption:String;
  function  CaptionlariYaz(Form:TForm;CompName:TObject):String;
  function  CaptionlariOku(FormIsmi,Baslik,Key:String;CompName:TObject):String;
  function  HintleriYaz(Form:TForm;CompName:TObject):String;
  function  HintleriOku(FormIsmi,Baslik,Key:String;CompName:TObject):String;
  procedure FormCaptionAndName(Form:TForm);
  procedure FormComponentCaptionAndHint(Form:TForm);
implementation

function CaptionlariYaz(Form:TForm;CompName:TObject):String;
var
j:integer;
begin
  if (CompName is TSpeedButton) and ((CompName As TSpeedButton).Caption<>'') then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TSpeedButton).Name ,(CompName As TSpeedButton).Caption);
  if (CompName is TToolButton)  and ((CompName As TToolButton).Caption<>'')  then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TToolButton).Name ,(CompName  As TToolButton).Caption);
  if (CompName is TRadioButton) and ((CompName As TRadioButton).Caption<>'') then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TRadioButton).Name ,(CompName As TRadioButton).Caption);
  if (CompName is TBitBtn)      and ((CompName As TBitBtn).Caption<>'')      then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TBitBtn).Name ,(CompName      As TBitBtn).Caption);
  if (CompName is TLabel)       and ((CompName As TLabel).Caption<>'')       then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TLabel).Name ,(CompName       As TLabel).Caption);
  if (CompName is TPanel)       and ((CompName As TPanel).Caption<>'')       then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TPanel).Name ,(CompName       As TPanel).Caption);
  if (CompName is TButton)      and ((CompName As TButton).Caption<>'')      then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TButton).Name ,(CompName      As TButton).Caption);
  if (CompName is TCheckBox)    and ((CompName As TCheckBox).Caption<>'')    then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TCheckBox).Name ,(CompName    As TCheckBox).Caption);
  if (CompName is TDBCheckBox)  and ((CompName As TDBCheckBox).Caption<>'')  then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TDBCheckBox).Name ,(CompName  As TDBCheckBox).Caption);
  if (CompName is TMenuItem)    and ((CompName As TMenuItem).Caption<>'')    then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TMenuItem).Name ,(CompName    As TMenuItem).Caption);
  if (CompName is TTabSheet)    and ((CompName As TTabSheet).Caption<>'')    then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TTabSheet).Name ,(CompName    As TTabSheet).Caption);
  if (CompName is TGroupBox)    and ((CompName As TGroupBox).Caption<>'')    then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName  As TGroupBox).Name ,(CompName    As TGroupBox).Caption);

  if (CompName is TRadioGroup)  then
  begin
    if ((CompName As TRadioGroup).Caption<>'') then
    a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TRadioGroup).Name ,(CompName As TRadioGroup).Caption);
     for j:=0 to (CompName As TRadioGroup).Items.Count-1 do
       if ((CompName As TRadioGroup).Items[j]<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TRadioGroup).Name+'_'+inttostr(j+1)+'.Item','')='') then
          a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TRadioGroup).Name+'_'+inttostr(j+1)+'.Item',(CompName As TRadioGroup).Items[j]);
  end;
  if (CompName is TDBRadioGroup)  then
  begin
    if ((CompName As TDBRadioGroup).Caption<>'') then
    a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBRadioGroup).Name ,(CompName As TDBRadioGroup).Caption);
     for j:=0 to (CompName As TDBRadioGroup).Items.Count-1 do
       if ((CompName As TDBRadioGroup).Items[j]<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBRadioGroup).Name+'_'+inttostr(j+1)+'.Item','')='') then
       a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBRadioGroup).Name+'_'+inttostr(j+1)+'.Item',(CompName As TDBRadioGroup).Items[j]);
  end;

  if (CompName is TDBGrid)      then
  begin
   for j:=0 to (CompName As TDBGrid).Columns.Count-1 do
     if ((CompName As TDBGrid).Columns[j].Title.Caption<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBGrid).Name+'_'+inttostr(j+1)+'.Column','')='') then
        a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBGrid).Name+'_'+inttostr(j+1)+'.Column',(CompName As TDBGrid).Columns[j].Title.Caption);
  end;

  if (CompName is TCheckListBox)  then
     for j:=0 to (CompName As TCheckListBox).Items.Count-1 do
       if ((CompName As TCheckListBox).Items[j]<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TCheckListBox).Name+'_'+inttostr(j+1)+'.Item','')='') then
          a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TCheckListBox).Name+'_'+inttostr(j+1)+'.Item',(CompName As TCheckListBox).Items[j]);

  if (CompName is TDBRadioGroup)  then
     for j:=0 to (CompName As TDBRadioGroup).Items.Count-1 do
       if ((CompName As TDBRadioGroup).Items[j]<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBRadioGroup).Name+'_'+inttostr(j+1)+'.Item','')='') then
          a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TDBRadioGroup).Name+'_'+inttostr(j+1)+'.Item',(CompName As TDBRadioGroup).Items[j]);

  if (CompName is TListView)      then
  begin
   for j:=0 to (CompName As TListView).Columns.Count-1 do
     if ((CompName As TListView).Columns[j].Caption<>'') and (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TListView).Name+'_'+inttostr(j+1)+'.Column','')='') then
        a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.'+(CompName As TListView).Name+'_'+inttostr(j+1)+'.Column',(CompName As TListView).Columns[j].Caption);
  end;
end;

function CaptionlariOku(FormIsmi,Baslik,Key:String;CompName:TObject):String;
var
j:integer;
begin
  //if (a.SectionExists(FormIsmi+'.'+Baslik)) and (a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'')<>'') then
  if (a.SectionExists(FormIsmi+'.'+Baslik)) then
  begin
    if (CompName is TSpeedButton) then (CompName As TSpeedButton).Caption:= a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TToolButton)  then (CompName As TToolButton).Caption:=  a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TRadioButton) then (CompName As TRadioButton).Caption:= a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TBitBtn)      then (CompName As TBitBtn).Caption:=      a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TLabel)       then (CompName As TLabel).Caption:=       a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TPanel)       then (CompName As TPanel).Caption:=       a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TButton)      then (CompName As TButton).Caption:=      a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TCheckBox)    then (CompName As TCheckBox).Caption:=    a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBCheckBox)  then (CompName As TDBCheckBox).Caption:=  a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TMenuItem)    then (CompName As TMenuItem).Caption:=    a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TTabSheet)    then (CompName As TTabSheet).Caption:=    a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TGroupBox)    then (CompName As TGroupBox).Caption:=    a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TRadioGroup)  then
    begin
       (CompName As TRadioGroup).Caption:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
       for j:=0 to (CompName As TRadioGroup).Items.Count-1 do
          (CompName As TRadioGroup).Items[j]:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Item','');
    end;
    if (CompName is TDBRadioGroup)  then
    begin
       (CompName As TDBRadioGroup).Caption:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
       for j:=0 to (CompName As TDBRadioGroup).Items.Count-1 do
          (CompName As TDBRadioGroup).Items[j]:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Item','');
    end;

    if (CompName is TDBGrid)      then
    begin
       for j:=0 to (CompName As TDBGrid).Columns.Count-1 do
          (CompName As TDBGrid).Columns[j].Title.Caption:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Column','');
    end;
    if (CompName is TCheckListBox)  then
       for j:=0 to (CompName As TCheckListBox).Items.Count-1 do
          (CompName As TCheckListBox).Items[j]:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Item','');
    if (CompName is TDBRadioGroup)  then
       for j:=0 to (CompName As TDBRadioGroup).Items.Count-1 do
          (CompName As TDBRadioGroup).Items[j]:=a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Item','');

    if (CompName is TListView)  then
       for j:=0 to (CompName As TListView).Columns.Count-1 do
          (CompName As TListView).Columns[j].Caption:= a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key+'_'+inttostr(j+1)+'.Column','');
  end;
end;
end;

function HintleriYaz(Form:TForm;CompName:TObject):String;
begin
  if (CompName is TSpeedButton) and ((CompName As TSpeedButton).Hint<>'') then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TSpeedButton).Name ,(CompName  As TSpeedButton).Hint);
  if (CompName is TToolButton)  and ((CompName As TToolButton).Hint<>'')  then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TToolButton).Name ,(CompName   As TToolButton).Hint);
  if (CompName is TRadioButton) and ((CompName As TRadioButton).Hint<>'') then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TRadioButton).Name ,(CompName  As TRadioButton).Hint);
  if (CompName is TBitBtn)      and ((CompName As TBitBtn).Hint<>'')      then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TBitBtn).Name ,(CompName       As TBitBtn).Hint);
  if (CompName is TLabel)       and ((CompName As TLabel).Hint<>'')       then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TLabel).Name ,(CompName        As TLabel).Hint);
  if (CompName is TPanel)       and ((CompName As TPanel).Hint<>'')       then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TPanel).Name ,(CompName        As TPanel).Hint);
  if (CompName is TButton)      and ((CompName As TButton).Hint<>'')      then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TButton).Name ,(CompName       As TButton).Hint);
  if (CompName is TCheckBox)    and ((CompName As TCheckBox).Hint<>'')    then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TCheckBox).Name ,(CompName     As TCheckBox).Hint);
  if (CompName is TDBCheckBox)  and ((CompName As TDBCheckBox).Hint<>'')  then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBCheckBox).Name ,(CompName   As TDBCheckBox).Hint);
  if (CompName is TMenuItem)    and ((CompName As TMenuItem).Hint<>'')    then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TMenuItem).Name ,(CompName     As TMenuItem).Hint);
  if (CompName is TTabSheet)    and ((CompName As TTabSheet).Hint<>'')    then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TTabSheet).Name ,(CompName     As TTabSheet).Hint);
  if (CompName is TGroupBox)    and ((CompName As TGroupBox).Hint<>'')    then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TGroupBox).Name ,(CompName     As TGroupBox).Hint);
  if (CompName is TRadioGroup)  and ((CompName As TRadioGroup).Hint<>'')  then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TRadioGroup).Name ,(CompName   As TRadioGroup).Hint);
  if (CompName is TDBRadioGroup)and ((CompName As TDBRadioGroup).Hint<>'')then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBRadioGroup).Name ,(CompName As TDBRadioGroup).Hint);
  if (CompName is TDBGrid)      and ((CompName As TDBGrid).Hint<>'')      then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBGrid).Name,(CompName        As TDBGrid).Hint);
  if (CompName is TDBEdit)      and ((CompName As TDBEdit).Hint<>'')      then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBEdit).Name,(CompName        As TDBEdit).Hint);
  if (CompName is TDBRadioGroup)and ((CompName As TDBRadioGroup).Hint<>'')then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBRadioGroup).Name,(CompName  As TDBRadioGroup).Hint);
  if (CompName is TListBox)     and ((CompName As TListBox).Hint<>'')     then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TListBox).Name ,(CompName      As TListBox).Hint);
  if (CompName is TTreeView)    and ((CompName As TTreeView).Hint<>'')    then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TTreeView).Name ,(CompName     As TTreeView).Hint);
  if (CompName is TCheckListBox)     and ((CompName As TCheckListBox).Hint<>'')     then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TCheckListBox).Name ,(CompName      As TCheckListBox).Hint);
  if (CompName is TDBLookupComboBox) and ((CompName As TDBLookupComboBox).Hint<>'') then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDBLookupComboBox).Name,(CompName        As TDBLookupComboBox).Hint);
  if (CompName is TDateTimePicker)   and ((CompName As TDateTimePicker).Hint<>'')   then a.WriteString(Form.Name+'.'+'Hints',Form.Name+'.'+(CompName  As TDateTimePicker).Name,(CompName          As TDateTimePicker).Hint);

end;

function HintleriOku(FormIsmi,Baslik,Key:String;CompName:TObject):String;
begin
  if (a.SectionExists(FormIsmi+'.'+Baslik)) and (a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'')<>'') then
  begin
    if (CompName is TSpeedButton)      then (CompName As TSpeedButton).Hint      := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TToolButton)       then (CompName As TToolButton).Hint       := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TRadioButton)      then (CompName As TRadioButton).Hint      := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TBitBtn)           then (CompName As TBitBtn).Hint           := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TLabel)            then (CompName As TLabel).Hint            := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TPanel)            then (CompName As TPanel).Hint            := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TButton)           then (CompName As TButton).Hint           := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TCheckBox)         then (CompName As TCheckBox).Hint         := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBCheckBox)       then (CompName As TDBCheckBox).Hint       := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TMenuItem)         then (CompName As TMenuItem).Hint         := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TTabSheet)         then (CompName As TTabSheet).Hint         := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TGroupBox)         then (CompName As TGroupBox).Hint         := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TRadioGroup)       then (CompName As TRadioGroup).Hint       := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBRadioGroup)     then (CompName As TDBRadioGroup).Hint     := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBGrid)           then (CompName As TDBGrid).Hint           := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBEdit)           then (CompName As TDBEdit).Hint           := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBRadioGroup)     then (CompName As TDBRadioGroup).Hint     := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TListBox)          then (CompName As TListBox).Hint          := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TTreeView)         then (CompName As TTreeView).Hint         := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TCheckListBox)     then (CompName As TCheckListBox).Hint     := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDBLookupComboBox) then (CompName As TDBLookupComboBox).Hint := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
    if (CompName is TDateTimePicker)   then (CompName As TDateTimePicker).Hint   := a.ReadString(FormIsmi+'.'+Baslik,FormIsmi+'.'+Key,'');
  end;
end;

procedure FormCaptionAndName(Form:TForm);
begin
  FormName:=Form.Name;
end;

procedure FormComponentCaptionAndHint(Form:TForm);
var
 I,J: Integer;
begin
  a.UpdateFile;
  if a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.Caption','') = '' then
     if (Form.Caption<>'') then a.WriteString(Form.Name+'.'+'Captions',Form.Name+'.Caption' ,Form.Caption);
  for i:=0 to Form.ComponentCount-1 do
  begin
       if (a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.'+Form.Components[i].Name,'')='') then
         CaptionlariYaz(Form,Form.Components[i]);
       if (a.ReadString(Form.Name+'.'+'Hints',Form.Name+'.'+Form.Components[i].Name,'')='') then
         HintleriYaz(Form,Form.Components[i]);
  end;

  for j:=0 to Form.ComponentCount-1 do
  begin
    Form.Caption := a.ReadString(Form.Name+'.'+'Captions',Form.Name+'.Caption' ,Form.Caption);
    CaptionlariOku(Form.Name,'Captions',Form.Components[j].Name,Form.Components[j]);
    HintleriOku(Form.Name,'Hints',Form.Components[j].Name,Form.Components[j]);
  end;
end;
end.

Ehil olmayanlara sabretmek ehil olanları parlatır.
Akıllı birisinden gelen cefa, bilgisizlerin vefasından iyidir.
Bilgiye ulaştı mı ayak, kanat olur
Biz insanı kıyafetiyle ağırlar bilgisiyle uğurlarız.
Mevlana
Cevapla