Old 18th July 2004, 22:44   #1
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
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.
KirillKr is offline   Reply With Quote
Old 18th July 2004, 23:44   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
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


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 19th July 2004, 13:44   #3
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?
KirillKr is offline   Reply With Quote
Old 19th July 2004, 13:56   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 19th July 2004, 14:33   #5
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Yes, I read this example, but I don't understand, how I can do my thing... sorry... Can you write code?
KirillKr is offline   Reply With Quote
Old 19th July 2004, 14:46   #6
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Quote:
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?
KirillKr is offline   Reply With Quote
Old 24th July 2004, 01:53   #7
ppppppp
Junior Member
 
Join Date: Jul 2004
Posts: 15
I hope NSIS can make section more easy, just like innosetup. Only set parameter,evry thing is OK.
ppppppp is offline   Reply With Quote
Old 27th July 2004, 09:16   #8
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
I create ini-file: 2 checkbox, 2 radiobutton.
How I can on fly enabled/disabled if second checkbox checked/unchecked?
KirillKr is offline   Reply With Quote
Old 27th July 2004, 14:56   #9
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Quote:
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:
code:

Section "Hello"
;
SectionEnd

Section "Hola"
;
SectionEnd



* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 27th July 2004, 22:56   #10
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
code:

[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]
KirillKr is offline   Reply With Quote
Old 27th July 2004, 23:08   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 27th July 2004, 23:27   #12
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Quote:
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...
KirillKr is offline   Reply With Quote
Old 28th July 2004, 00:51   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 28th July 2004, 01:38   #14
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to 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.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 28th July 2004, 05:56   #15
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Quote:
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?
KirillKr is offline   Reply With Quote
Old 28th July 2004, 11:28   #16
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
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
Attached Files
File Type: zip cs-demo.zip (1.3 KB, 131 views)
pengyou is offline   Reply With Quote
Old 28th July 2004, 12:13   #17
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
If he still wants the InstallOptions way, here is a code example totally tested by me:

code:
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)

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 31st July 2004, 08:34   #18
KirillKr
Member
 
Join Date: Feb 2004
Location: Kaliningrad, RF
Posts: 74
Send a message via ICQ to KirillKr
Great thanks.
pengyou Your code working.
deguix I can't remade your code for me...
KirillKr is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump