Archive: Sections


Sections
Sorry, but I can't understand how I can do this.
I want write Half-Life installer.
I have sections:
HL - always installed
CSTRIKE - may be installed or not
NiceBot - install if CSTRIKE selected
ZBot - install of CSTRIKE selected.
NiceBot and ZBot must be radio button, because they can't be installed together.


No need the raio buttons, NSIS uses checkboxes, well... you can make your own custom page with InstallOptions.

I recommend that you read the example one-section.nsi


Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?


It's not as simple to just 'write the code'.
You need to create a custom InstallOptions dialogue with radio-buttons.

See NSIS\Contrib\InstallOptions

-Stu


Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?


Originally posted by Afrow UK
It's not as simple to just 'write the code'.
You need to create a custom InstallOptions dialogue with radio-buttons.

See NSIS\Contrib\InstallOptions

-Stu
Standart select component not be usefull?

I hope NSIS can make section more easy, just like innosetup. Only set parameter,evry thing is OK.


I create ini-file: 2 checkbox, 2 radiobutton.
How I can on fly enabled/disabled if second checkbox checked/unchecked?


Originally posted by ppppppp
I hope NSIS can make section more easy, just like innosetup. Only set parameter,evry thing is OK.
How more easy can be just doing this:

Section "Hello"
;
SectionEnd

Section "Hola"
;
SectionEnd


[Settings]
NumFields=7
Title=Install Components

[Field 1]
Type=GroupBox
Left=120
Top=0
Right=255
Bottom=55
Text=Êîìïîíåíòû (Addons)

[Field 2]
Type=GroupBox
Left=120
Top=60
Right=255
Bottom=100
Text=Áîòû (Bots)
Flags=DISABLED

[Field 3]
Type=Checkbox
Left=125
Top=15
Right=250
Bottom=25
Text=Install Counter-Strike
State=1

[Field 4]
Type=Checkbox
Left=125
Top=35
Right=250
Bottom=45
Text=Install bots for CS
State=0

[Field 5]
Type=RadioButton
Left=125
Top=70
Right=250
Bottom=80
Text=NiceBot
State=0
Flags=DISABLED

[Field 6]
Type=RadioButton
Left=125
Top=85
Right=250
Bottom=95
Text=ZBot
State=0
Flags=DISABLED

[Field 7]
Type=Bitmap
Text=spforce.bmp
Top=1
Left=1
Right=80
Bottom=120

How I can on checkin [field 4] enable/disable [FIELD 2]

InstallOptionsEx might be able to do this (if it can't then it would be nice if it could!)

As far as I know (or remember) for normal InstallOptions, you can't have selecting one checkbox unselect another.


-Stu


Originally posted by Afrow UK
InstallOptionsEx might be able to do this (if it can't then it would be nice if it could!)

As far as I know (or remember) for normal InstallOptions, you can't have selecting one checkbox unselect another.


-Stu
No, InstallOptionEx check input on PageLeave too...

Well in that case, unless deguix plans on changing IOEx to support live dialogue manipulation then I'm afraid there's nothing you can do except do it the old fassioned way.

-Stu


This part of InstallOptions is already very well planned by kichik and eccles (and others who contributed). Most parts of InstallOptions are preserved or expended in InstallOptionsEx. But yes, new things arrived to the plugin. One of the things expanded is the NOTIFY flag which is enough to your objective in this case.

The NOTIFY flag makes a control to return its value to the INI file, and to return the focus to the script code.

To make a selection of a checkbox, you can send BM_SETCHECK message to the checkbox to be selected/deselected.

To know more about the NOTIFY flag, see InstallOptions or InstallOptionEx readme.


Originally posted by deguix
This part of InstallOptions is already very well planned by kichik and eccles (and others who contributed). Most parts of InstallOptions are preserved or expended in InstallOptionsEx. But yes, new things arrived to the plugin. One of the things expanded is the NOTIFY flag which is enough to your objective in this case.

The NOTIFY flag makes a control to return its value to the INI file, and to return the focus to the script code.

To make a selection of a checkbox, you can send BM_SETCHECK message to the checkbox to be selected/deselected.

To know more about the NOTIFY flag, see InstallOptions or InstallOptionEx readme.
Where I must send message? In which function or other?

Lobo Lunar suggested earlier in this thread that one-section.nsi could be adapted to suit KirillKr's requirements.

Here are two variants based upon one-section.nsi:

CSdemo-A.nsi supports three options:

(1) Install HL
(2) Install HL + CSTRIKE + NiceBot
(3) Install HL + CSTRIKE + ZBot

CSdemo-B.nsi supports four options:

(1) Install HL
(2) Install HL + CSTRIKE
(3) Install HL + CSTRIKE + NiceBot
(4) Install HL + CSTRIKE + ZBot


If he still wants the InstallOptions way, here is a code example totally tested by me:

Page custom ShowFunction LeaveFunction

!define BM_GETCHECK 0x00F0
!define BM_SETCHECK 0x00F1

!define BST_UNCHECKED 0
!define BST_CHECKED 1

Var hwnd
Var Result
Var notifySel

Function ShowFunction

InstallOptions::initDialog /NOUNLOAD ".\test.ini"
Pop $hwnd
InstallOptions::show
Pop $Result

FunctionEnd

Function LeaveFunction

ReadINIStr $notifySel ".\test.ini" "Settings" "State"

StrCmp $notifySel 0 Validate ; Next button
StrCmp $notifySel 4 Start4 ; Field 4
Abort ; Return to the page

Start4:

GetDlgItem $0 $hwnd 1203
SendMessage $0 ${BM_GETCHECK} "" "" $1

StrCmp $1 ${BST_CHECKED} 0 EndChecked

GetDlgItem $0 $hwnd 1201
EnableWindow $0 1

GetDlgItem $0 $hwnd 1204
EnableWindow $0 1
SendMessage $0 ${BM_GETCHECK} "" "" $1

GetDlgItem $0 $hwnd 1205
EnableWindow $0 1
SendMessage $0 ${BM_GETCHECK} "" "" $2

StrCmp $1 ${BST_UNCHECKED} 0 EndCheckIfEmpty
StrCmp $2 ${BST_UNCHECKED} 0 EndCheckIfEmpty

GetDlgItem $0 $hwnd 1204
SendMessage $0 ${BM_SETCHECK} ${BST_CHECKED} ""

EndCheckIfEmpty:

Goto EndNotChecked

EndChecked:

GetDlgItem $0 $hwnd 1201
EnableWindow $0 0

GetDlgItem $0 $hwnd 1204
EnableWindow $0 0

GetDlgItem $0 $hwnd 1205
EnableWindow $0 0

EndNotChecked:

Abort

Validate:

FunctionEnd


(But as you know, you have to change somethings to be compatible with your script)

Great thanks.
pengyou Your code working.
deguix I can't remade your code for me...