[Inno Setup] Crear un boton

Iniciado por DeXon18, 11 Abril 2014, 13:26 PM

0 Miembros y 1 Visitante están viendo este tema.

DeXon18

HOla buenas, llevo toda la mañana mirando como crear un boton(justo al lado de atras) en el apartado de la selección de los complementos, y que cuando se pulse en el aparezca como un label que muestre lo que tengo generado en el codigo.
Código (pascal) [Seleccionar]

[Setup]
Appname=My Program
AppVername=My Program version 1.5
DefaultDirname=%25257Bpf%25257D%25255CMy Program
DefaultGroupname=My Program
OutputDir=.

[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: "readme\en"; Description: "English"; Flags: exclusive
Name: "readme\de"; Description: "German"; Flags: exclusive

[Files]
Source: descctrl.dll; Flags: dontcopy

[_Code]
#ifdef UNICODE
 #define AW "W"
#else
 #define AW "A"
#endif

type
 HMONITOR = THandle;
 TMonitorInfo = record
   cbSize: DWORD;
   rcMonitor: TRect;
   rcWork: TRect;
   dwFlags: DWORD;
 end;

const
 MONITOR_DEFAULTTONULL = $0;
 MONITOR_DEFAULTTOPRIMARY = $1;
 MONITOR_DEFAULTTONEAREST = $2;

function GetMonitorInfo(hMonitor: HMONITOR; out lpmi: TMonitorInfo): BOOL;
 external 'GetMonitorInfo{#AW}@user32.dll stdcall';
function MonitorFromWindow(hwnd: HWND; dwFlags: DWORD): HMONITOR;
 external 'MonitorFromWindow@user32.dll stdcall';

procedure CenterForm(Form: TForm; Horz, Vert: Boolean);
var
 X, Y: Integer;
 Monitor: HMONITOR;
 MonitorInfo: TMonitorInfo;
begin
 if not (Horz or Vert) then
   Exit;
 Monitor := MonitorFromWindow(Form.Handle, MONITOR_DEFAULTTONEAREST);
 MonitorInfo.cbSize := SizeOf(MonitorInfo);
 if GetMonitorInfo(Monitor, MonitorInfo) then
 begin
   if not Horz then
     X := Form.Left
   else
     X := MonitorInfo.rcWork.Left + ((MonitorInfo.rcWork.Right -
       MonitorInfo.rcWork.Left) - Form.Width) div 2;
   if not Vert then
     Y := Form.Top
   else
     Y := MonitorInfo.rcWork.Top + ((MonitorInfo.rcWork.Bottom -
       MonitorInfo.rcWork.Top) - Form.Height) div 2;
   Form.SetBounds(X, Y, Form.Width, Form.Height);
 end;
end;


function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';

var
 Info: TNewStaticText;
 InfoCaption: TNewStaticText;
 InfoPanel: TPanel;

procedure DeinitializeSetup();
begin
 disabledesc();
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;



// Meter esto al pulsar el botón detalles
 procedure InitializeWizard();
 begin
   WizardForm.ComponentsList.Height := ScaleY(90);
   WizardForm.ComponentsList.Width := ScaleX(415);

   InfoPanel := TPanel.Create(WizardForm);
   InfoPanel.Parent := WizardForm.SelectComponentsPage;
   InfoPanel.Top := Scaley(360);
   InfoPanel.Left := ScaleX(0);
   InfoPanel.Width := WizardForm.ComponentsList.Width;
   InfoPanel.Height := ScaleY(50);
   InfoPanel.BevelInner := bvRaised;
   InfoPanel.BevelOuter := bvLowered;
   Info := TNewStaticText.Create(WizardForm);
   Info.Parent := InfoPanel;
   Info.AutoSize := true;
   Info.Left := ScaleX(6);
   Info.Width := ScaleX(400);
   Info.Top := ScaleY(5); // Linea de texto
   Info.WordWrap := true;
   enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
         // Sustituir por ExpandConstant('{cm:Descripcion};') +
        'Descrip. Program Files;'+
        'Descrip. Help File;'+
        'Descrip. Readme File;'+
        'Descrip. English;'+
        'Descrip. German;'
        );

   begin
     CompPageModified := False;
   end;
 end;
// Meter esto al pulsar el botón detalles


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


Espero que me podais hechar una mano ya no se donde mirar ya que no encuentro mucha informacion.
Un saludo y mil gracias de antemano