Jump to content
Korean Random
EvilAlex

Создание инсталляторов для модпаков на базе Inno Setup

Recommended Posts

Hello Everyone.

I need help....

When the components page is loaded, I want to increase the Width size.

And.... In addition.

I want to adjust the location of the 'About' button. 

 

Could anyone help me? Thanks so much in advanced.

 

[setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output


[Types]
Name: "full"; Description: "Full installation"
Name: "compact"; Description: "Compact installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help File"; Types: full
Name: "readme"; Description: "Readme File"; Types: full
Name: "readmeen"; Description: "English"; Flags: exclusive
Name: "readmede"; Description: "German"; Flags: exclusive


procedure AboutButtonOnClick(Sender: TObject);
begin
MsgBox('This is a demo of how to create a button!', mbInformation, mb_Ok);
end;

procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton);
var
AboutButton: TNewButton;
begin
AboutButton := TNewButton.Create(ParentForm);
AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
AboutButton.Top := CancelButton.Top;
AboutButton.Width := CancelButton.Width;
AboutButton.Height := CancelButton.Height;
AboutButton.Caption := '&About...';
AboutButton.OnClick := @AboutButtonOnClick;
AboutButton.Parent := ParentForm;
end;


procedure InitializeWizard1();
begin
CreateAboutButton(WizardForm, WizardForm.CancelButton);
end;

type
TPositionStorage = array of Integer;

var
CompPageModified: Boolean;
CompPagePositions: TPositionStorage;

procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
SetArrayLength(Storage, 10);

Storage[0] := WizardForm.Height;
Storage[1] := WizardForm.NextButton.Top;
Storage[2] := WizardForm.BackButton.Top;
Storage[3] := WizardForm.CancelButton.Top;
Storage[4] := WizardForm.ComponentsList.Height;
Storage[5] := WizardForm.OuterNotebook.Height;
Storage[6] := WizardForm.InnerNotebook.Height;
Storage[7] := WizardForm.Bevel.Top;
Storage[8] := WizardForm.BeveledLabel.Top;
Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
end;

procedure LoadComponentsPage(const Storage: TPositionStorage;
HeightOffset: Integer);
begin
if GetArrayLength(Storage) <> 10 then
RaiseException('Invalid storage array length.');

WizardForm.Height := Storage[0] + HeightOffset;
WizardForm.NextButton.Top := Storage[1] + HeightOffset;
WizardForm.BackButton.Top := Storage[2] + HeightOffset;
WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;
WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
WizardForm.Bevel.Top := Storage[7] + HeightOffset;
WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
end;

procedure InitializeWizard2();
begin
CompPageModified := False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurpageID = wpSelectComponents then
begin
SaveComponentsPage(CompPagePositions);
LoadComponentsPage(CompPagePositions, 200);
CompPageModified := True;
end
else
if CompPageModified then
begin
LoadComponentsPage(CompPagePositions, 0);
CompPageModified := False;
end;
end;

procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end;
 

Share this post


Link to post

Short link
Share on other sites

neosecure, something like this:

procedure ResizeComponentsPage(CurPageID: Integer);
begin
  case CurPageID of
    wpSelectComponents:
    begin
      .........
    end;

procedure CurPageChanged(CurPageID: Integer);
begin
  ResizeComponentsPage(CurPageID);
end;
or more simple:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output


[Types]
Name: "full"; Description: "Full installation"
Name: "compact"; Description: "Compact installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help File"; Types: full
Name: "readme"; Description: "Readme File"; Types: full
Name: "readmeen"; Description: "English"; Flags: exclusive
Name: "readmede"; Description: "German"; Flags: exclusive

[~~~~~~~~~~~~~~~~~~~~~Code~~~~~~~~~~~~~~~~~~~~~]
var
AboutButton: TNewButton;

procedure AboutButtonOnClick(Sender: TObject);
begin
MsgBox('This is a demo of how to create a button!', mbInformation, mb_Ok);
end;

procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton);
begin
AboutButton := TNewButton.Create(ParentForm);
AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
AboutButton.Top := CancelButton.Top;
AboutButton.Width := CancelButton.Width;
AboutButton.Height := CancelButton.Height;
AboutButton.Caption := '&About...';
AboutButton.OnClick := @AboutButtonOnClick;
AboutButton.Parent := ParentForm;
end;


procedure InitializeWizard1();
begin
CreateAboutButton(WizardForm, WizardForm.CancelButton);
end;

type
TPositionStorage = array of Integer;

var
CompPageModified: Boolean;
CompPagePositions: TPositionStorage;

procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
SetArrayLength(Storage, 11);

Storage[0] := WizardForm.Height;
Storage[1] := WizardForm.NextButton.Top;
Storage[2] := WizardForm.BackButton.Top;
Storage[3] := WizardForm.CancelButton.Top;
Storage[4] := WizardForm.ComponentsList.Height;
Storage[5] := WizardForm.OuterNotebook.Height;
Storage[6] := WizardForm.InnerNotebook.Height;
Storage[7] := WizardForm.Bevel.Top;
Storage[8] := WizardForm.BeveledLabel.Top;
Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
Storage[10] := AboutButton.Top;
end;

procedure LoadComponentsPage(const Storage: TPositionStorage;
HeightOffset: Integer);
begin
if GetArrayLength(Storage) <> 11 then
RaiseException('Invalid storage array length.');

WizardForm.Height := Storage[0] + HeightOffset;
WizardForm.NextButton.Top := Storage[1] + HeightOffset;
WizardForm.BackButton.Top := Storage[2] + HeightOffset;
WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;
WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
WizardForm.Bevel.Top := Storage[7] + HeightOffset;
WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
AboutButton.Top := Storage[10] + HeightOffset;
end;

procedure InitializeWizard2();
begin
CompPageModified := False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurpageID = wpSelectComponents then
begin
SaveComponentsPage(CompPagePositions);
LoadComponentsPage(CompPagePositions, 100);
CompPageModified := True;
end
else
if CompPageModified then
begin
LoadComponentsPage(CompPagePositions, 0);
CompPageModified := False;
end;
end;

procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end;
Edited by AtotIK

Share this post


Link to post

Short link
Share on other sites

procedure ResizeComponentsPage(CurPageID: Integer);

begin

case CurPageID of

wpSelectComponents:

begin

.........

end;

 

procedure CurPageChanged(CurPageID: Integer);

begin

ResizeComponentsPage(CurPageID);

end;

 

//=======================================================================

// AtotIK... I appreciate your kindness :)

// I add "ResizeComponentsPage()"

// But,... there is no change.

// For example, https://www.dropbox.com/s/4a9blb9q6keoer2/cats.jpg

// When the components page is loaded, I want to increase the Width size.

// Is there a way?

// Only the width of the components page ...

// I ask for help again.

// Have a good day ! :)

//=======================================================================

 

 

[setup]

AppName=My Program

AppVersion=1.5

DefaultDirName={pf}My Program

DefaultGroupName=My Program

UninstallDisplayIcon={app}MyProg.exe

OutputDir=userdocs:Inno Setup Examples Output

 

 

[Types]

Name: "full"; Description: "Full installation"

Name: "compact"; Description: "Compact installation"

Name: "custom"; Description: "Custom installation"; Flags: iscustom

 

[Components]

Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed

Name: "help"; Description: "Help File"; Types: full

Name: "readme"; Description: "Readme File"; Types: full

Name: "readmeen"; Description: "English"; Flags: exclusive

Name: "readmede"; Description: "German"; Flags: exclusive

 

var

AboutButton: TNewButton;

 

procedure AboutButtonOnClick(Sender: TObject);

begin

MsgBox('This is a demo of how to create a button!', mbInformation, mb_Ok);

end;

 

procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton);

begin

AboutButton := TNewButton.Create(ParentForm);

AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;

AboutButton.Top := CancelButton.Top;

AboutButton.Width := CancelButton.Width;

AboutButton.Height := CancelButton.Height;

AboutButton.Caption := '&About...';

AboutButton.OnClick := @AboutButtonOnClick;

AboutButton.Parent := ParentForm;

end;

 

 

procedure InitializeWizard1();

begin

CreateAboutButton(WizardForm, WizardForm.CancelButton);

end;

 

type

TPositionStorage = array of Integer;

 

var

CompPageModified: Boolean;

CompPagePositions: TPositionStorage;

 

procedure SaveComponentsPage(out Storage: TPositionStorage);

begin

SetArrayLength(Storage, 11);

 

Storage[0] := WizardForm.Height;

Storage[1] := WizardForm.NextButton.Top;

Storage[2] := WizardForm.BackButton.Top;

Storage[3] := WizardForm.CancelButton.Top;

Storage[4] := WizardForm.ComponentsList.Height;

Storage[5] := WizardForm.OuterNotebook.Height;

Storage[6] := WizardForm.InnerNotebook.Height;

Storage[7] := WizardForm.Bevel.Top;

Storage[8] := WizardForm.BeveledLabel.Top;

Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;

Storage[10] := AboutButton.Top;

end;

 

procedure LoadComponentsPage(const Storage: TPositionStorage;

HeightOffset: Integer);

begin

if GetArrayLength(Storage) <> 11 then

RaiseException('Invalid storage array length.');

 

WizardForm.Height := Storage[0] + HeightOffset;

WizardForm.NextButton.Top := Storage[1] + HeightOffset;

WizardForm.BackButton.Top := Storage[2] + HeightOffset;

WizardForm.CancelButton.Top := Storage[3] + HeightOffset;

WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;

WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;

WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;

WizardForm.Bevel.Top := Storage[7] + HeightOffset;

WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;

WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;

AboutButton.Top := Storage[10] + HeightOffset;

end;

 

procedure InitializeWizard2();

begin

CompPageModified := False;

end;

 

//--- procedure CurPageChanged(CurPageID: Integer);

//--- I add this ...

 

procedure ResizeComponentsPage(CurPageID: Integer);

begin

if CurpageID = wpSelectComponents then

begin

SaveComponentsPage(CompPagePositions);

LoadComponentsPage(CompPagePositions, 200);

CompPageModified := True;

end

else

if CompPageModified then

begin

LoadComponentsPage(CompPagePositions, 0);

CompPageModified := False;

end;

end;

 

 

procedure CurPageChanged(CurPageID: Integer);

begin

ResizeComponentsPage(CurPageID);

end;

 

procedure InitializeWizard();

begin

InitializeWizard1();

InitializeWizard2();

end;

Edited by neosecure

Share this post


Link to post

Short link
Share on other sites

neosecure, thous code for example, you MUST think by yourself in next time.

post-12922-0-21601400-1429118311_thumb.png

 

 

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}My Program
DefaultGroupName=My Program
OutputDir=Output

[Messages]
BeveledLabel=Debug Bevel

[Types]
Name: "full"; Description: "Full installation"
Name: "compact"; Description: "Compact installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help File"; Types: full
Name: "readme"; Description: "Readme File"; Types: full
Name: "readmeen"; Description: "English"; Flags: exclusive
Name: "readmede"; Description: "German"; Flags: exclusive

[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
var
  AboutButton: TNewButton;

procedure AboutButtonOnClick(Sender: TObject);
begin
  MsgBox('This is a demo of how to create a button!', mbInformation, mb_Ok);
end;

procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton);
begin
  AboutButton:=TNewButton.Create(ParentForm);
  AboutButton.Left:=ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
  AboutButton.Top:=CancelButton.Top;
  AboutButton.Width:=CancelButton.Width;
  AboutButton.Height:=CancelButton.Height;
  AboutButton.Caption:='&About...';
  AboutButton.OnClick:=@AboutButtonOnClick;
  AboutButton.Parent:=ParentForm;
end;


procedure InitializeWizard1();
begin
  CreateAboutButton(WizardForm, WizardForm.CancelButton);
end;

type
  TPositionStorage = array of Integer;

var
  CompPageModified: Boolean;
  CompPagePositions: TPositionStorage;

procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
  SetArrayLength(Storage, 25);

  Storage[0]:=WizardForm.Height;
  Storage[1]:=WizardForm.NextButton.Top;
  Storage[2]:=WizardForm.BackButton.Top;
  Storage[3]:=WizardForm.CancelButton.Top;
  Storage[4]:=WizardForm.ComponentsList.Height;
  Storage[5]:=WizardForm.OuterNotebook.Height;
  Storage[6]:=WizardForm.InnerNotebook.Height;
  Storage[7]:=WizardForm.Bevel.Top;
  Storage[8]:=WizardForm.BeveledLabel.Top;
  Storage[9]:=WizardForm.ComponentsDiskSpaceLabel.Top;
  Storage[10]:=AboutButton.Top;
  Storage[11]:=WizardForm.Width;
  Storage[12]:=WizardForm.NextButton.Left;
  Storage[13]:=WizardForm.BackButton.Left;
  Storage[14]:=WizardForm.CancelButton.Left;
  Storage[15]:=WizardForm.ComponentsList.Width;
  Storage[16]:=WizardForm.OuterNotebook.Width;
  Storage[17]:=WizardForm.InnerNotebook.Width;
  Storage[18]:=WizardForm.Bevel.Width;
  Storage[19]:=WizardForm.BeveledLabel.Height;
  Storage[20]:=WizardForm.TypesCombo.Width;
  Storage[21]:=WizardForm.Bevel1.Width;
  Storage[22]:=WizardForm.WizardSmallBitmapImage.Left;
  Storage[23]:=WizardForm.MainPanel.Width;
  Storage[24]:=WizardForm.SelectComponentsLabel.Width;
end;

procedure LoadComponentsPage(const Storage: TPositionStorage; HeightOffset, WidthOffset: Integer);
begin
if GetArrayLength(Storage) <> 25 then
  RaiseException('Invalid storage array length.');

  WizardForm.Height:=Storage[0] + HeightOffset;
  WizardForm.NextButton.Top:=Storage[1] + HeightOffset;
  WizardForm.BackButton.Top:=Storage[2] + HeightOffset;
  WizardForm.CancelButton.Top:=Storage[3] + HeightOffset;
  WizardForm.ComponentsList.Height:=Storage[4] + HeightOffset;
  WizardForm.OuterNotebook.Height:=Storage[5] + HeightOffset;
  WizardForm.InnerNotebook.Height:=Storage[6] + HeightOffset;
  WizardForm.Bevel.Top:=Storage[7] + HeightOffset;
  WizardForm.BeveledLabel.Top:=Storage[8] + HeightOffset;
  WizardForm.ComponentsDiskSpaceLabel.Top:=Storage[9] + HeightOffset;
  AboutButton.Top:=Storage[10] + HeightOffset;
  
  WizardForm.Width:=Storage[11] + WidthOffset;
  WizardForm.NextButton.Left:=Storage[12] + WidthOffset;
  WizardForm.BackButton.Left:=Storage[13] + WidthOffset;
  WizardForm.CancelButton.Left:=Storage[14] + WidthOffset;
  WizardForm.ComponentsList.Width:=Storage[15] + WidthOffset;
  WizardForm.OuterNotebook.Width:=Storage[16] + WidthOffset;
  WizardForm.InnerNotebook.Width:=Storage[17] + WidthOffset;
  WizardForm.Bevel.Width:=Storage[18] + WidthOffset;
  WizardForm.BeveledLabel.Height:=Storage[19] + WidthOffset;
  WizardForm.TypesCombo.Width:=Storage[20] + WidthOffset;
  WizardForm.Bevel1.Width:=Storage[21] + WidthOffset;
  WizardForm.WizardSmallBitmapImage.Left:=Storage[22] + WidthOffset;
  WizardForm.MainPanel.Width:=Storage[23] + WidthOffset;
  WizardForm.SelectComponentsLabel.Width:=Storage[24] + WidthOffset;
end;

procedure InitializeWizard2();
begin
  CompPageModified:=False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurpageID = wpSelectComponents then
begin
  SaveComponentsPage(CompPagePositions);
  LoadComponentsPage(CompPagePositions, 200, 200);
  CompPageModified:=True;
end
else
if CompPageModified then
begin
  LoadComponentsPage(CompPagePositions, 0, 0);
  CompPageModified:=False;
end;
end;

procedure InitializeWizard();
begin
  InitializeWizard1();
  InitializeWizard2();
end;

voin_123, там весь скрипт переписывать надо, т.к. писался он на коленке.

Edited by AtotIK

Share this post


Link to post

Short link
Share on other sites

 

 

тупой вопрос, но какого хрена не переносит файл
И откуда ты это выполняешь?

Share this post


Link to post

Short link
Share on other sites

вопрос: есть стандартная форма компонентов wpSelectComponents и костомная ComponentsPage1
проверка на выбор хотя бы одного компонента

if CurPageID = ComponentsPage1.ID then
                if WizardSelectedComponents(False) = '' then 
begin 
MsgBox('Ни один из компонентов не выбран!', mbInformation, MB_OK); 
Result:= False; 
end;

со стандартной работает, а во с кастомной не хочет
помогите, плиз...

Share this post


Link to post

Short link
Share on other sites

И откуда ты это выполняешь?

уже решил проблему 

Как 

IsComponentSelected

 использовать для нового листа? Или какая есть альтернатива?

Share this post


Link to post

Short link
Share on other sites

Как 

IsComponentSelected

 использовать для нового листа? Или какая есть альтернатива?

Никак.

Можно сделать аналог, но проверять нужно будет не по имени компонента, а по его индексу в компонентЛисте. Или сразу обращаться к листу.

 

вопрос: есть стандартная форма компонентов wpSelectComponents и костомная ComponentsPage1

проверка на выбор хотя бы одного компонента

if WizardSelectedComponents(False) = '' then

со стандартной работает, а во с кастомной не хочет

И не должно.

Как вариант:

Function NextButtonClick(CurPageID: Integer): Boolean;
var
 I, NotCheckedCount: Integer;
begin
 Result := True;
 NotCheckedCount := 0;
 if CurPageID = страница_с_компонент_листом.ID then
 begin
  for I := 0 to твой_компонент_лист.Items.Count - 1 do
  begin
   if not твой_компонент_лист.Checked[I] then
    NotCheckedCount := NotCheckedCount + 1;
  end;
  Result := (NotCheckedCount = твой_компонент_лист.Items.Count);
  if not Result then
   MsgBoxEx(WizardForm.Handle, 'Ни один из представленных компонентов не выбран.', 'Выбор компонентов', MB_OK or MB_MB_ICONWARNING, 0, 0);
 end;
end;
Edited by Kotyarko_O
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

 

Никак.

Можно сделать аналог, но проверять нужно будет не по имени компонента, а по его индексу в компонентЛисте. Или сразу обращаться к листу.

 

как это сделать? и еще  как сделать  тип установки для нового листа?

Edited by Dark_Knight_MiX

Share this post


Link to post

Short link
Share on other sites
как это сделать?

Так:

Function IsComponentChecked(Idx: Integer): Boolean;
begin
 Result := твой_компонент_лист.Checked[Idx];
end;

Применять на подобии IsComponentSelected, но с индексом компонента в кастомном компонентЛисте. Не забывай, что счёт начинается с 0, но для удобства и это можно подкорректировать; надеюсь, сам поймёшь как.

Edited by Kotyarko_O

Share this post


Link to post

Short link
Share on other sites

Так:

Function IsComponentChecked(Idx: Integer): Boolean;
begin
 Result := твой_компонент_лист.Checked[Idx];
end;

Применять на подобии IsComponentSelected, но с индексом компонента в кастомном компонентЛисте.

 

тоесть вот так ?

function IsComponent(CompIndex: Integer): Boolean;
var
  i: Integer;
begin
  Result := False;
  for i := 0 to ComponentsList1.ItemCount - 1 do
  begin
    if CompIndex <= (ComponentsList1.ItemCount - 1) then
      Result := ComponentsList1.Checked[CompIndex];
  end;
end;
If (IsComponent('1')) 

Share this post


Link to post

Short link
Share on other sites

 

 

как сделать тип установки для нового листа?
Он будет работать менее удобно, чем в стандартном компонентЛисте.

Share this post


Link to post

Short link
Share on other sites

Он будет работать менее удобно, чем в стандартном компонентЛисте.

так как к новому прицепить? 

Share this post


Link to post

Short link
Share on other sites

 

 

If (IsComponent('1'))
Учи типы данных. Integer кавычками не выделяется.
If IsComponent(1)

Share this post


Link to post

Short link
Share on other sites

Не забывай, что счёт начинается с 0, но для удобства и это можно подкорректировать; надеюсь, сам поймёшь как.

:ok:

Учи типы данных. Integer кавычками не выделяется.

If IsComponent(1)

ясно

Как сделать тип установки для нового листа и что бы при последующий переустановки  его выбор сохранялся?

Share this post


Link to post

Short link
Share on other sites

 

 

Как сделать тип установки для нового листа и что бы при последующий переустановки его выбор сохранялся?
Давно бы уже загуглил TNewComboBox.

Для сохранения ранее установленных параметров нужно при установке сохранять выбранные компоненты, а затем считывать их.

Тут есть пример.

Share this post


Link to post

Short link
Share on other sites

Я использую второй вариант, но это только "верхушка" айсберга, там же ещё присвоить всем компонентам идентификаторы, записать их в файл и потом считать при следующей установке так, что бы всё правильно отметилось. В общем мозговой штурм ещё тот получается.

Share this post


Link to post

Short link
Share on other sites

Давно бы уже загуглил TNewComboBox.

Для сохранения ранее установленных параметров нужно при установке сохранять выбранные компоненты, а затем считывать их.

Тут есть пример.

 

и как прицепить, что то не допер 

[Setup]
AppName=Моя программа
AppVersion=1.5
DefaultDirName={pf}\Моя программа
DirExistsWarning=no
AppendDefaultDirName=no

[CustomMessages]
CompName1=Компонент 1
CompName2=Компонент 2
CompSubtitlesLng=Язык субтитров
CompVoiceLng=Язык озвучки
CompRussian=Русский
CompEnglish=Английский

[Code]
var
ComboBox: TNewComboBox;
Page: TWizardPage;
var
ComponentsList1: TNewCheckListBox;
procedure CreateWizardPages;
begin
begin
Page := CreateCustomPage(wpWelcome, '', '');
ComboBox := TNewComboBox.Create(Page);
ComboBox.Width := Page.SurfaceWidth;
ComboBox.Parent := Page.Surface;
ComboBox.Style := csDropDownList;
ComboBox.Items.Add('TComboBox 1');
ComboBox.Items.Add('TComboBox 2');
ComboBox.Items.Add('TComboBox 3');
ComboBox.Items.Add('TComboBox 4');
ComboBox.Items.Add('TComboBox 5');
ComboBox.Items.Add('TComboBox 6');
ComboBox.Items.Add('TComboBox 7');
ComboBox.ItemIndex := 0;
end;
//========================================================================\\
ComponentsList1 := TNewCheckListBox.Create(WizardForm);
with ComponentsList1 do
begin
Parent := Page.Surface;
SetBounds(ScaleX(0), ScaleY(61), ScaleX(417), ScaleY(169));
AddCheckBox(CustomMessage('CompSubtitlesLng'), '', 0, True, True, False, True, nil); //0
AddRadioButton(CustomMessage('CompRussian'), '', 1, True, True, nil); //1
AddRadioButton(CustomMessage('CompEnglish'), '', 1, True, True, nil); //2
AddCheckBox(CustomMessage('CompVoiceLng'), '', 0, True, True, False, True, nil); //3
AddRadioButton(CustomMessage('CompRussian'), '', 1, True, True, nil); //4
AddRadioButton(CustomMessage('CompEnglish'), '', 1, True, True, nil); //5
end;
end;
function IsComponentsForm1(CompIndex: Integer): Boolean;
var
i: Integer;
begin
Result := False;
for i := 0 to ComponentsList1.ItemCount - 1 do
begin
if CompIndex <= (ComponentsList1.ItemCount - 1) then
Result := ComponentsList1.Checked[CompIndex];
end;
end;
procedure InitializeWizard();
begin
CreateWizardPages;
end;

Я использую второй вариант, но это только "верхушка" айсберга, там же ещё присвоить всем компонентам идентификаторы, записать их в файл и потом считать при следующей установке так, что бы всё правильно отметилось. В общем мозговой штурм ещё тот получается.

этот 

[setup]
AppName=MyApp
AppVerName=MyApp
DefaultDirName={pf}\MyApp

[components]
name: comp1; description: comp1;
name: comp1\1; description: comp1_1;
name: comp2; description: comp2;
name: comp1\1; description: comp2_1;
name: comp3; description: comp3;
name: comp3\1; description: comp3_1;
name: comp4; description: comp4;

[code]
var
ConfigList: TStringList;

function CheckConfigName(CompName: String): Longint;
var
i: Integer;
begin
Result:= -1;
if (ConfigList.Count <= 0) then
Exit;

if ConfigList.Find(CompName, i) then
Result:= i;
end;


procedure InitializeWizard();
begin
ConfigList:= TStringList.Create();
ConfigList.LoadFromFile('E:\Setup.ini');

if (CheckConfigName('St1\Comp1') >= 0) then
WizardForm.ComponentsList.CheckItem(0, coCheckWithChildren);

if (CheckConfigName('St1\Comp3\3') >= 0) then
WizardForm.ComponentsList.CheckItem(5, coCheckWithChildren);
end;

procedure DeinitializeSetup();
begin
ConfigList.Free();
end;

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...