AlekseyPopovvAlekseyPopovv 12:12 02-01-2014Цитата: Ребята помогите. Как сделать, что бы при выборе языка, менялась картинка? Например: Русский язык-флаг русский и т.д.
[more=Пример]
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppExeName "MyProg.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Files]
Source: rus.bmp; Flags: dontcopy solidbreak
Source: eng.bmp; Flags: dontcopy solidbreak
Source: ukr.bmp; Flags: dontcopy solidbreak
;Source: rus.txt; DestDir:{app}; Check: Lang1 and install;
;Source: eng.txt; DestDir:{app}; Check: Lang2 and install;
;Source: ukr.txt; DestDir:{app}; Check: Lang3 and install;
;Source: rus.txt; DestDir:{tmp}\portable; Check: Lang1 and portab;
;Source: eng.txt; DestDir:{tmp}\portable; Check: Lang2 and portab;
;Source: ukr.txt; DestDir:{tmp}\portable; Check: Lang3 and portab;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: Lang1 and install;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: Lang2 and install;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: Lang3 and install;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{localappdata}\portable"; Flags: ignoreversion uninsrestartdelete; Check: Lang1 and portab;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{localappdata}\portable"; Flags: ignoreversion uninsrestartdelete; Check: Lang2 and portab;
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{localappdata}\portable"; Flags: ignoreversion uninsrestartdelete; Check: Lang3 and portab;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ; Check: Comp2;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: Comp2;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: Comp1;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang1 and install;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang2 and install;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang3 and install;
Filename: "{localappdata}\portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang1 and portab;
Filename: "{localappdata}\portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang2 and portab;
Filename: "{localappdata}\portable\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Check: Lang3 and portab;
[Code]
var
Component: TWizardPage;
portable,installer,LangRus,LangEng,LangUkr: TNewRadioButton;
FlagImage: TBitmapImage;
Lang,Copmp: TLabel;
CompPanel: TPanel;
Icons,PuskIcons: TNewCheckBox;
function InitializeSetup(): Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\rus.bmp')) then ExtractTemporaryFile('rus.bmp');
if not FileExists(ExpandConstant('{tmp}\eng.bmp')) then ExtractTemporaryFile('eng.bmp');
if not FileExists(ExpandConstant('{tmp}\ukr.bmp')) then ExtractTemporaryFile('ukr.bmp');
Result := True;
end;
function Lang1: Boolean;
begin
Result:= LangRus.Checked;
end;
function Lang2: Boolean;
begin
Result:= LangEng.Checked;
end;
function Lang3: Boolean;
begin
Result:= LangUkr.Checked;
end;
function Comp1: Boolean;
begin
Result:= Icons.Checked;
end;
function Comp2: Boolean;
begin
Result:= PuskIcons.Checked;
end;
function install: Boolean;
begin
Result := installer.Checked;
end;
function portab: Boolean;
begin
Result := portable.Checked;
end;
procedure CopmpClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
portable:
begin
Icons.Checked:=False;
Icons.Enabled:= Icons.Checked;
PuskIcons.Checked:=False;
PuskIcons.Enabled:= PuskIcons.Checked;
end;
installer:
begin
Icons.Checked:=True;
Icons.Enabled:= Icons.Checked;
PuskIcons.Checked:=True;
PuskIcons.Enabled:= PuskIcons.Checked;
end;
end;
end;
procedure LangClick(Sender: TObject);
begin
case TNewRadioButton(Sender) of
LangRus:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\rus.bmp'));
FlagImage.Left := ScaleX(232);
end;
LangEng:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\eng.bmp'));
FlagImage.Left := ScaleX(262);
end;
LangUkr:
begin
FlagImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\ukr.bmp'));
FlagImage.Left := ScaleX(282);
end;
end;
end;
procedure InitializeWizard();
begin
Component := CreateCustomPage(wpSelectDir, 'Выбор компонентов', 'Какие компоненты должны быть установлены?');
FlagImage := TBitmapImage.Create(WizardForm);
with FlagImage do
begin
Name := 'FlagImage';
Parent := Component.Surface;
Left := ScaleX(232);
Top := ScaleY(120);
Width := ScaleX(100);
Height := ScaleY(75);
end;
CompPanel := TPanel.Create(WizardForm);
with CompPanel do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(100);
BevelOuter := bvNone;
end;
Copmp := TLabel.Create(WizardForm);
with Copmp do
begin
Parent := CompPanel;
Caption := 'Тип и компоненты:';
Left := ScaleX(0);
Top := ScaleY(5);
Width := ScaleX(150);
Height := ScaleY(13);
end;
portable := TNewRadioButton.Create(WizardForm);
with portable do
begin
Parent := CompPanel;
Left := ScaleX(5);
Top := ScaleY(25);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Распаковка портативной версий';
OnClick:=@CopmpClick;
end;
Icons := TNewCheckBox.Create(WizardForm);
with Icons do
begin
Parent := CompPanel;
Left := ScaleX(25);
Top := ScaleY(65);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Ярлык(и) на «Рабочем столе»';
Checked:=True;
end;
PuskIcons := TNewCheckBox.Create(WizardForm);
with PuskIcons do
begin
Parent := CompPanel;
Left := ScaleX(25);
Top := ScaleY(85);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Ярлык в «Пуск меню»';
Checked:=True;
end;
installer := TNewRadioButton.Create(WizardForm);
with installer do
begin
Parent := CompPanel;
Left := ScaleX(5);
Top := ScaleY(45);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Установка обычной версий';
OnClick:=@CopmpClick;
Checked:=True;
end;
Lang := TLabel.Create(WizardForm);
with Lang do
begin
Parent := Component.Surface;
Caption := 'Язык интерфейса:';
Left := ScaleX(0);
Top := ScaleY(120);
Width := ScaleX(150);
Height := ScaleY(13);
end;
LangRus := TNewRadioButton.Create(WizardForm);
with LangRus do
begin
Parent := Component.Surface;
Left := ScaleX(5);
Top := ScaleY(135);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Язык интерфейса Русский';
OnClick:=@LangClick;
Checked:=True;
end;
LangEng := TNewRadioButton.Create(WizardForm);
with LangEng do
begin
Parent := Component.Surface;
Left := ScaleX(5);
Top := ScaleY(155);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Язык интерфейса Английский';
OnClick:=@LangClick;
end;
LangUkr := TNewRadioButton.Create(WizardForm);
with LangUkr do
begin
Parent := Component.Surface;
Left := ScaleX(5);
Top := ScaleY(175);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Язык интерфейса Украйнский';
OnClick:=@LangClick;
end;
end;[/more]