Войти

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 3]


Страниц : 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188

Imitri7
13-12-2010, 16:57
nik1967, спасибо, только чет не так получается del чекбокс есть, а самой надписи нет

nik1967
13-12-2010, 18:00
Imitri7,
У тебя чекбокс расположен на WizardForm.InstallingPage;, а в примере на WizardForm;. Чтобы у тебя работало, нужно так:
[Setup]
AppName=My Program
AppVerName=My Program
DefaultDirName={pf}\My Program
OutputDir=.

[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl

[Files]
Source: {sys}\*.dll; DestDir: {app}; Flags: external deleteafterinstall;

[_code]
function GetSystemMetrics(nIndex: Integer): Integer;
external 'GetSystemMetrics@user32.dll stdcall';

var
MyCheck: TCheckBox;
MyCheckLabel: TLabel;

procedure MyCheckOnClick(Sender: TObject);
begin
if MyCheck.Checked = False then
MyCheck.Checked:= True else
MyCheck.Checked:= False;
end;

procedure StandartForm();
begin
with WizardForm do
begin
ClientWidth := ScaleX(497);
ClientHeight := ScaleY(360);
Center;
Bevel.Show;
Bevel1.Show;
MainPanel.Show;
with InnerNotebook do
begin
Left := ScaleX(40);
Top := ScaleY(72);
Width := ScaleX(417);
end;
with StatusLabel do
Width := ScaleX(417);
with FileNameLabel do
begin
ScaleY(16);
Width := ScaleX(417);
end;
with ProgressGauge do
begin
Top := ScaleY(42);
Width := ScaleX(417);
end;
with CancelButton do
begin
Left := ScaleX(412);
Top := ScaleY(327);
end;
end;
with MyCheck do
Top := ScaleY(208);
with MyCheckLabel do begin
Top := ScaleY(209);
Left := ScaleX(20);
end;
end;

procedure MyNewForm();
begin
with WizardForm do
begin
ClientWidth := ScaleX(395);
ClientHeight := ScaleY(120);
Left := GetSystemMetrics(16) - ClientWidth - ScaleX(8);
Top := GetSystemMetrics(17) - ClientHeight - ScaleY(8);
Bevel.Hide;
Bevel1.Hide;
MainPanel.Hide;
with InnerNotebook do
begin
Left := ScaleX(10);
Top := ScaleY(10);
Width := WizardForm.ClientWidth - ScaleX(20);
end;
with StatusLabel do
Width := InnerNotebook.Width;

with FileNameLabel do
begin
Top := ScaleY(20);
Width := InnerNotebook.Width;
end;
with ProgressGauge do
begin
Top := ScaleY(40);
Width := InnerNotebook.Width;
end;
with CancelButton do
begin
Left := WizardForm.ClientWidth div 2 - CancelButton.Width div 2;
Top := WizardForm.ClientHeight - CancelButton.Height - ScaleY(10);
BringToFront;
end;
end;
with MyCheck do
Top := WizardForm.CancelButton.Top -7;
with MyCheckLabel do begin
Top := WizardForm.CancelButton.Top -6;
Left := ScaleX(20);
end;
end;

procedure GetWizardForm(Sender: TObject);
begin
if MyCheck.Checked then
MyNewForm()
else
StandartForm();
end;

procedure InitializeWizard();
begin
MyCheck := TCheckBox.Create(WizardForm);
with MyCheck do
begin
Top := ScaleY(208);
Width := ScaleX(15);
OnClick := @GetWizardForm;
Parent := WizardForm.InstallingPage;
end;
MyCheckLabel := TLabel.Create(WizardForm);
with MyCheckLabel do begin
AutoSize:=False;
Left := ScaleX(20);
Top := ScaleY(209);
Width := ScaleX(150);
Transparent:=True;
//Font.Name:= 'Tahoma'
//Font.Size:= 8;
Font.Color:=clRed;
Caption := 'Компактный размер';
Parent:= WizardForm.InstallingPage;
OnClick:= @MyCheckOnClick;
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
MyCheck.Checked := False;
end;

Imitri7
13-12-2010, 18:29
nik1967,
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpInstalling then
begin
WizardForm.CancelButton.Left:=ScaleX(122);
WizardForm.CancelButton.Top:=ScaleY(70);
ButtonPanel[bidCancel].Left := WizardForm.CancelButton.Left;
ButtonPanel[bidCancel].Top := WizardForm.CancelButton.Top;
end;
end;
аналог этого как-то реализовать для StandartForm и MyNewForm можно?

serg aka lain
13-12-2010, 20:46
как-то реализовать для StandartForm и MyNewForm можно? »
А что конкретно не получается?

Imitri7
13-12-2010, 21:26
serg aka lain нужно сделать текстуринг кнопок с помошью const
ButtonWidth = 80; //Указываем размер кнопок
ButtonHeight = 23;

bidBack = 0;
bidNext = 1;
bidCancel = 2;
bidDirBrowse = 3;
bidGroupBrowse = 4;

var
ButtonPanel: array [0..4] of TPanel;
ButtonImage: array [0..4] of TBitmapImage;
ButtonLabel: array [0..4] of TLabel;

procedure ButtonLabelClick(Sender: TObject);
var
Button: TButton;
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
case TLabel(Sender).Tag of
bidBack: Button:=WizardForm.BackButton
bidNext: Button:=WizardForm.NextButton
bidCancel: Button:=WizardForm.CancelButton
bidDirBrowse: Button:=WizardForm.DirBrowseButton
bidGroupBrowse: Button:=WizardForm.GroupBrowseButton
else
Exit
end
Button.OnClick(Button)
end;

procedure ButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ButtonLabel[TLabel(Sender).Tag].Enabled then
ButtonImage[TLabel(Sender).Tag].Left:=-ButtonWidth
end;

procedure ButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ButtonImage[TLabel(Sender).Tag].Left:=0
end;

procedure LoadButtonImage(AButton: TButton; AButtonIndex: integer);
var
Image: TBitmapImage;
Panel: TPanel;
Labl: TLabel;

begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=AButton.Left
Panel.Top:=AButton.Top
Panel.Width:=AButton.Width
Panel.Height:=AButton.Height
Panel.Tag:=AButtonIndex
Panel.Parent:=AButton.Parent
ButtonPanel[AButtonIndex]:=Panel

Image:=TBitmapImage.Create(WizardForm) //Рисунок который ложится на кнопку
Image.Width:=160 //Обязательно прописать оригинальный размер рисунка
Image.Height:=23
Image.Enabled:=False
Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\button.bmp'))
Image.Parent:=Panel
ButtonImage[AButtonIndex]:=Image

with TLabel.Create(WizardForm) do begin
Tag:=AButtonIndex
Parent:=Panel
Width:=Panel.Width
Height:=Panel.Height
Transparent:=True
OnClick:=@ButtonLabelClick
OnDblClick:=@ButtonLabelClick
OnMouseDown:=@ButtonLabelMouseDown
OnMouseUp:=@ButtonLabelMouseUp
end

Labl:=TLabel.Create(WizardForm) //Текст кнопок
Labl.Left:=23 //Указываем положение текста
Labl.Top:=5
Labl.Autosize:=True
Labl.Alignment:=taCenter
Labl.Tag:=AButtonIndex
Labl.Transparent:=True
Labl.Font.Color:=clFont //Цвет текста
Labl.Caption:=AButton.Caption
Labl.OnClick:=@ButtonLabelClick
Labl.OnDblClick:=@ButtonLabelClick
Labl.OnMouseDown:=@ButtonLabelMouseDown
Labl.OnMouseUp:=@ButtonLabelMouseUp
Labl.Parent:=Panel
ButtonLabel[AButtonIndex]:=Labl
end;

procedure UpdateButton(AButton: TButton;AButtonIndex: integer);
begin
ButtonLabel[AButtonIndex].Caption:=AButton.Caption
ButtonPanel[AButtonIndex].Visible:=AButton.Visible
ButtonLabel[AButtonIndex].Enabled:=Abutton.Enabled
end;

procedure LicenceAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=True
ButtonPanel[bidNext].Enabled := True
end;

procedure LicenceNotAcceptedRadioOnClick(Sender: TObject);
begin
ButtonLabel[bidNext].Enabled:=False
ButtonPanel[bidNext].Enabled := False
end;

procedure CurPageChanged(CurPageID: Integer);
begin
UpdateButton(WizardForm.BackButton,bidBack)
UpdateButton(WizardForm.NextButton,bidNext)
UpdateButton(WizardForm.CancelButton,bidCancel)
ButtonLabel[bidBack].Left := (ButtonPanel[bidBack].Width / 2 - ButtonLabel[bidBack].Width / 2);
ButtonLabel[bidNext].Left := (ButtonPanel[bidNext].Width / 2 - ButtonLabel[bidNext].Width / 2);
ButtonLabel[bidCancel].Left := (ButtonPanel[bidCancel].Width / 2 - ButtonLabel[bidCancel].Width / 2);
ButtonLabel[bidDirBrowse].Left := (ButtonPanel[bidDirBrowse].Width / 2 - ButtonLabel[bidDirBrowse].Width / 2);
ButtonLabel[bidGroupBrowse].Left := (ButtonPanel[bidGroupBrowse].Width / 2 - ButtonLabel[bidGroupBrowse].Width / 2);
end;

procedure InitializeWizard();
begin
WizardForm.BackButton.Width:=ButtonWidth
WizardForm.BackButton.Height:=ButtonHeight

WizardForm.NextButton.Width:=ButtonWidth
WizardForm.NextButton.Height:=ButtonHeight

WizardForm.CancelButton.Width:=ButtonWidth
WizardForm.CancelButton.Height:=ButtonHeight

WizardForm.DirBrowseButton.Left:=337
WizardForm.DirBrowseButton.Width:=ButtonWidth
WizardForm.DirBrowseButton.Height:=ButtonHeight

WizardForm.GroupBrowseButton.Left:=337
WizardForm.GroupBrowseButton.Width:=ButtonWidth
WizardForm.GroupBrowseButton.Height:=ButtonHeight

WizardForm.LicenseAcceptedRadio.OnClick:=@LicenceAcceptedRadioOnClick

WizardForm.LicenseNotAcceptedRadio.OnClick:=@LicenceNotAcceptedRadioOnClick

ExtractTemporaryFile('button.bmp')
LoadButtonImage(WizardForm.BackButton,bidBack)
LoadButtonImage(WizardForm.NextButton,bidNext)
LoadButtonImage(WizardForm.CancelButton,bidCancel)
LoadButtonImage(WizardForm.DirBrowseButton,bidDirBrowse)
LoadButtonImage(WizardForm.GroupBrowseButton,bidGroupBrowse)
end;

чет я как уже не пробовал, все кнопки с текстурой кроме кнопки отмены в StandartForm и MyNewForm :(

serg aka lain
13-12-2010, 21:47
чет я как уже не пробовал, все кнопки с текстурой кроме кнопки отмены в StandartForm и MyNewForm »
А новые координаты для bidCancel, в процедурах (StandartForm, MyNewForm) пробовал?

ButtonPanel[bidCancel].Left := WizardForm.CancelButton.Left;
ButtonPanel[bidCancel].Top := WizardForm.CancelButton.Top;

з.ы. и удали контрол BringToFront у кнопки CancelButton, т.к. текстура (панелька) будет слетать.

ChVL
13-12-2010, 21:53
Habetdin,

IMHO, при такой записи указание версии относится к файлам, а привязки к версии системы нет

Habetdin
13-12-2010, 22:26
ChVL, IMHO, при такой записи указание версии относится к файлам, а привязки к версии системы нет »
С точностью до наоборот:
MinVersion
A minimum Windows version and Windows NT version respectively for the entry to be processed. If you use "0" for one of the versions then the entry will never be processed on that platform. If you leave one of the versions empty then the entry will use the default MinVersion for that platform. Build numbers and/or service pack levels may be included in the version numbers. This overrides any MinVersion directive in the script's [Setup] section.

An entry without a MinVersion parameter is always processed, unless other parameters say it shouldn't be.

Example:
MinVersion: 4.0,4.0
MinVersion: 4.1,

OnlyBelowVersion
Basically the opposite of MinVersion. Specifies the minimum Windows and Windows NT version for the entry not to be processed. For example, if you put 4.1,5.0 and the user is running Windows 95 or NT 4.0 the entry will be processed, but if the user is running Windows 98 (which reports its version as 4.1) or Windows 2000 (which reports its version as NT 5.0), it will not be processed. Putting "0" for one of the versions means there is no upper version limit. Build numbers and/or service pack levels may be included in the version numbers. This overrides any OnlyBelowVersion directive in the script's [Setup] section.

An entry without an OnlyBelowVersion parameter is always processed, unless other parameters say it shouldn't be.

Example:
OnlyBelowVersion: 4.1,5.0

STRAYKER
14-12-2010, 17:17
http://i081.radikal.ru/1012/11/a8d35ea55b76.jpg
КАК СОЗДАТЬ ТАКОЕ ???

actavir
14-12-2010, 21:51
Всем привет. Подскажите пожалуйста почему при данном скрипте
--------------------
[CustomMessages]
rus.ArcTitle=Распаковка архивов FreeArc...
rus.ExtractedInfo=Распаковано %1 Мб из %2 Мб
rus.ArcInfo=Архив: %1 из %2
rus.AllArcProgress=Прогресс распаковки архивов: %1%%
rus.Extracting=Распаковывается: %1
rus.Taskbar=%1%%, ждите %2
rus.ArcRemains=Осталось ждать %1
rus.LongTime=вечно
rus.Ending=завершение
rus.ArcFail=Распаковка архивов не завершена!
rus.ArcBreak=Распаковка архивов прервана!
rus.ArcFinishedHeading=Установка игры {#GameName} не завершена
rus.ArcError=Установка игры {#GameVerName} не была завершена.
rus.ArcTrouble=Пожалуйста, устраните проблему и запустите установку снова.
rus.ArcBroken=Возможно, архив %1 повреждён или недостаточно места на диске назначения.
------------------------
вылетает ошибка: Unknown Language name "rus"

Habetdin
14-12-2010, 21:59
actavir, [Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl

actavir
14-12-2010, 22:04
Спосибо за тот ответ у меня сразу же назрел ещё один вопрос:

Код: TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;
Ошибка: Unknown indentifier 'PAnsiChar'
Что делать?

RyoTsubaki
14-12-2010, 22:36
Прошу прощения за простой и глупый вопрос.
В конце инсталяции мы видим "Обновить игру" и чекбокс с галочкой. Как сделать что бы галочку нельзя было снять?
Или же как совсем отключить последнее окно?
И как первое?(Здравствуйте, вас приветствует..)
Да, знаю что задаю глупый вопрос, если сегодня не найду ответа сам - буду рад помощи.

serg aka lain
14-12-2010, 23:54
Как сделать что бы галочку нельзя было снять? »
Если чекбокс один, то так->

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
WizardForm.RunList.ItemEnabled[0] := False;
end;
Или же как совсем отключить последнее окно? »

[Setup]
DisableFinishedPage=True

И как первое?(Здравствуйте, вас приветствует..) »

[Setup]
DisableWelcomePage=True

Всё это есть в Help'e (можно вызвать нажатием F1)

RyoTsubaki
15-12-2010, 00:04
Всё это есть в Help'e (можно вызвать нажатием F1) »
Заставило умереть от стыда =(
Спасибо, надеюсь сегодня закончу работу.

actavir
15-12-2010, 10:40
Люди выручайте. Написал вот такой скрипт (http://forum.oszone.net/attachment.php?attachmentid=56274&stc=1&d=1292398648)

Ошибка вылезает на строчке TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;
Посмотрите код, если можно подкорректируйте его.
Заранее спасибо!!!!

Imitri7
15-12-2010, 12:30
serg aka lain, спасибо большое, все работает

STRAYKER
15-12-2010, 13:43
Как создать такую задачу ??
http://tracker.od.ua/forum/files/img/10060122491410365_f5_4.jpg

actavir
15-12-2010, 15:59
Народ подскажите как использовать freearc в inno setup. Если можно пример с объяснением. А ещё лучше дайте номер аси и я поспрашиваю что не понятно.
"Не погу разобрать. Заколебался"
Заранее спосибо.

Wilddeer
15-12-2010, 17:00
Народ подскажите как использовать freearc в inno setup. Если можно пример с объяснением. А ещё лучше дайте номер аси и я поспрашиваю что не понятно.
"Не погу разобрать. Заколебался"
Заранее спосибо.

Присоединяюсь!
Жду помощи!




© OSzone.net 2001-2012