SeroЦитата: А можно сделать ListBox и в нем добавить скины чтобы можно было быбрать?
-- [more=Тут]
Код: [Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Files]
Source: callnsis.dll; Flags: dontcopy
[Code]
const
DefaultSkin = 'SkinNsis.skf';
var
Button: TButton;
SkinList: TStringList;
SkinBox: TListBox;
Form: TSetupForm;
OKButton, CancelButton: TButton;
procedure callplug(parentwnd: Integer; pluginname,funcname,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10: PChar);
external 'callplug@files:callnsis.dll stdcall';
procedure SkinsOnClick(Sender: TObject);
begin
callplug(0, ExpandConstant('{src}\skin\NSIS_SkinCrafter_Plugin.dll'),
'skin',
ExpandConstant('{src}\skin\' + SkinBox.Items[SkinBox.ItemIndex]),
'','','','','','','','','');
end;
procedure CreateSkinForm();
var
i: integer;
begin
Form:= CreateCustomForm;
Form.ClientWidth := ScaleX(256);
Form.ClientHeight := ScaleY(256);
Form.Caption := 'Select Skin';
Form.CenterInsideControl(WizardForm, False);
SkinBox := TListBox.Create(WizardForm);
SkinBox.Width := Form.ClientWidth;
SkinBox.Parent := Form;
SkinBox.ItemIndex := 0;
SkinBox.Top := ScaleY(8);
SkinBox.Height := Form.ClientHeight - ScaleY(50);
SkinBox.OnClick:= @SkinsOnClick;
SkinBox.Items:= SkinList;
for i:= 0 to SkinBox.Items.Count - 1 do
begin
if SkinBox.Items[i] = DefaultSkin then
SkinBox.ItemIndex:= i;
end;
OKButton := TButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 10);
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
OKButton.Caption := 'OK';
OKButton.ModalResult := mrOk;
CancelButton := TButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX(75);
CancelButton.Height := ScaleY(23);
CancelButton.Left := Form.ClientWidth - ScaleX(75 + 10);
CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
CancelButton.Caption := 'Cancel';
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;
Form.ActiveControl := SkinBox;
end;
procedure GetSkins();
var
FindRec: TFindRec;
begin
SkinList := TStringList.Create();
if FindFirst(ExpandConstant('{src}\skin\*.skf'), FindRec) then begin
try
repeat
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
begin
SkinList.Add(FindRec.Name);
end;
until not FindNext(FindRec);
finally
FindClose(FindRec);
end;
end;
end;
procedure ButtonOnClick(Sender: TObject);
var
OldSkin: Integer;
begin
OldSkin:= SkinBox.ItemIndex;
if Form.ShowModal() = mrCancel then
begin
callplug(0, ExpandConstant('{src}\skin\NSIS_SkinCrafter_Plugin.dll'),
'skin',
ExpandConstant('{src}\skin\' + SkinBox.Items[OldSkin]),
'','','','','','','','','');
SkinBox.ItemIndex:= OldSkin;
end;
end;
procedure InitializeWizard();
begin
Button := TButton.Create(WizardForm);
Button.Left := 10;
Button.Top := WizardForm.CancelButton.Top;
Button.Width := WizardForm.CancelButton.Width + 30;
Button.Height := WizardForm.CancelButton.Height;
Button.Caption := 'Change Skin...';
Button.OnClick := @ButtonOnClick;
Button.Parent := WizardForm;
WizardForm.Position:=poDesktopCenter
WizardForm.Height:=WizardForm.Height-40
GetSkins();
callplug(0, ExpandConstant('{src}\skin\NSIS_SkinCrafter_Plugin.dll'),
'skin',
ExpandConstant('{src}\skin\' + DefaultSkin),
'','','','','','','','','');
CreateSkinForm();
end;