- NSIS Discussion
- Sections
Archive: Sections
KirillKr
18th July 2004 22:44 UTC
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.
Joel
18th July 2004 23:44 UTC
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
KirillKr
19th July 2004 13:44 UTC
Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?
Afrow UK
19th July 2004 13:56 UTC
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
KirillKr
19th July 2004 14:33 UTC
Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?
KirillKr
19th July 2004 14:46 UTC
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?
ppppppp
24th July 2004 01:53 UTC
I hope NSIS can make section more easy, just like innosetup. Only set parameter,evry thing is OK.
KirillKr
27th July 2004 09:16 UTC
I create ini-file: 2 checkbox, 2 radiobutton.
How I can on fly enabled/disabled if second checkbox checked/unchecked?
Joel
27th July 2004 14:56 UTC
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
KirillKr
27th July 2004 22:56 UTC
[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]
Afrow UK
27th July 2004 23:08 UTC
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
KirillKr
27th July 2004 23:27 UTC
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...
Afrow UK
28th July 2004 00:51 UTC
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
deguix
28th July 2004 01:38 UTC
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.
KirillKr
28th July 2004 05:56 UTC
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?
pengyou
28th July 2004 11:28 UTC
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
deguix
28th July 2004 12:13 UTC
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)
KirillKr
31st July 2004 08:34 UTC
Great thanks.
pengyou Your code working.
deguix I can't remade your code for me...