unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils,
System.Variants, System.Classes,
Vcl.Graphics,
inifiles,System.IOUtils,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.ComCtrls;
type
TypeVisRecord =
record
TabName :
String;
TabINdex :Integer;
TabVis :Boolean;
end;
TForm1 =
class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Panel1: TPanel;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
procedure make_tabs_visible();
public
{ Public-Deklarationen }
procedure IniSchreiben(Sender: TObject);
procedure IniAuslesen(Sender: TObject);
end;
var
Form1: TForm1;
Versions:
Array of TypeVisRecord;
mylabel:
Array of Tlabel;
myCheckboxes:
Array of TCheckbox;
VERS:
string;
VIS_Count: integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
VERs:='
v3';
setlength(Versions, 10);
iniauslesen(Sender);
make_tabs_visible();
end;
procedure TForm1.IniAuslesen(Sender: TObject);
var
Ini: TIniFile;
i: Integer;
//2
Point_Counts,combobox3_Count,combobox4_Count: integer;
combobox3_selectedIndex,combobox4_selectedIndex : integer;
begin
Ini := TIniFile.Create(TPath.GetTempPath+VERS+ChangeFileExt(ExtractFilename(Application.ExeName),'
.ini'));
//3
VIS_Count := Ini.ReadInteger('
Query-Terms','
Count' ,2);
for I := 0
to VIS_Count-1
do
begin
Versions[i].TabName:=Ini.ReadString ('
Versonizing',Format('
TabName[%d]',[i]),PageControl1.Pages[i].
name);
Versions[i].TabVis :=ini.ReadBool('
Versonizing',Format('
Visible[%d]',[i]),true);
Versions[i].TabINdex :=ini.ReadInteger('
Versonizing',Format('
TabIndex[%d]',[i]),PageControl1.Pages[i].TabIndex)
end;
Ini.Free;
end;
procedure TForm1.IniSchreiben(Sender: TObject);
var
Ini: TIniFile;
i: integer;
begin
try
Ini := TIniFile.Create(TPath.GetTempPath+VERS+ChangeFileExt(ExtractFilename(Application.ExeName),'
.ini'));
//3
Ini.WriteInteger('
Query-Terms','
Count' ,VIS_count);
for I := 0
to VIS_Count-1
do
begin
Ini.WriteString ('
Versonizing',Format('
TabName[%d]',[i]),Versions[i].TabName);
ini.WriteBool('
Versonizing',Format('
Visible[%d]',[i]),Versions[i].TabVis);
ini.WriteInteger('
Versonizing',Format('
TabIndex[%d]',[i]),Versions[i].TabINdex)
end;
Ini.Free;
except
ShowMessage('
Es konnte das INI File nicht geschrieben werden. Sie muessen zur ' +
'
Registrierung das Programm als Administrator starten, damit der PC' +
'
das INI-Lizenzfile in den Programm Folder speichern kann!');
end;
end;
procedure tform1.make_tabs_visible();
var
i: Integer;
begin
//Label1 is the HEADLINE in the Panel1
setlength(mylabel, VIS_count);
setlength(myCheckboxes, VIS_count);
for i := 0
to VIS_COUNT-1
do
begin
mylabel[i]:=Tlabel.Create(panel1);
mylabel[i].Top:=label1.Top+10+10*i;
mylabel[i].left:=70;
mylabel[i].visible:=true;
mylabel[i].Caption:=Versions[i].tabname;
myCheckboxes[i]:=TCheckbox.create(panel1);
myCheckboxes[i].Top:=label1.Top+10+10*i;
myCheckboxes[i].visible:=true;
myCheckboxes[i].left:=mylabel[i].width + 10;
myCheckboxes[i].checked:=Versions[i].TabVis;
pagecontrol1.Pages[i].visible:=myCheckboxes[i].Checked;
end;
end;
end.