Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 23rd March 2003, 22:38   #1
Mosestycoon
Senior Member
 
Mosestycoon's Avatar
 
Join Date: Feb 2003
Location: outter space
Posts: 139
Send a message via ICQ to Mosestycoon
Question CustomPage with input from "type=text"

Again me -

After successfully working with 'RadioButtons' and 'CheckBoxes' on CustomPages, I need some help on 'Type=text'

What I am looking for is a description on how the input is written down e.g.
code:
[Field n]
Type=text
Left=...
Right=...
Top=...
Bottom=...
State=123



The value from the 'state' (I take this as default value and as an example for users, if they don't know what they should type) should be written down to a file with the good old search and replace-function. So the 'state' value should replace a placeholder in a ascii-file.

The other question is:
There must be a value given back, even when the user clears the input.
(see attached image). How can this be achieved?

Thx in advance
Chris
Attached Images
File Type: png image.png (17.5 KB, 89 views)
Mosestycoon is offline   Reply With Quote
Old 23rd March 2003, 23:03   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,351
Send a message via ICQ to deguix
Quote:
Originally posted by Mosestycoon
There must be a value given back, even when the user clears the input. How can this be achieved?

Thx in advance
Chris
Use:

PHP Code:
;Read the old value

!insertmacro MUI_INSTALLOPTIONS_READ $"inifile.ini" "Field #" "State"

;Show the page

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "inifile.ini"

;Read the new value

!insertmacro MUI_INSTALLOPTIONS_READ $"inifile.ini" "Field #" "State"

StrCmp $"" 0 End

  
;If the user delete the statewrite the old value...
  !
insertmacro MUI_INSTALLOPTIONS_WRITE "inifile.ini" "Field #" "State" "$0"

End

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 23rd March 2003, 23:13   #3
Mosestycoon
Senior Member
 
Mosestycoon's Avatar
 
Join Date: Feb 2003
Location: outter space
Posts: 139
Send a message via ICQ to Mosestycoon
I'll give it a try deguix

Thx
Chris

P.S.: I won't reply for now, because its 1:10 am and I'll go to bed. (Even cigaretts don't make me fit anymore and I feel like )
So tomorrow (or better said in a few hours) I'll give it a try and post the result.
Mosestycoon is offline   Reply With Quote
Old 24th March 2003, 00:50   #4
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 569
In the NSIS Archives there is an article called "Complex validating of InstallOptions user input" which shows how to access data entered by the user.

The article can be found at
http://nsis.sourceforge.net/archive/...instances=0,64

If you want to prevent the user from clearing the text box, you could use MinLen and ValidateText in the INI file (see the InstallOptions manual for details). If the user clears all the text, InstallOptions will display a message box containing the text from ValidateText.

Last edited by pengyou; 24th March 2003 at 01:30.
pengyou is offline   Reply With Quote
Old 24th March 2003, 06:19   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,351
Send a message via ICQ to deguix
In this case not Pengyou, he wants to return the default value (the old state of the control) if the user delete the value and click next >.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 24th March 2003, 06:58   #6
Mosestycoon
Senior Member
 
Mosestycoon's Avatar
 
Join Date: Feb 2003
Location: outter space
Posts: 139
Send a message via ICQ to Mosestycoon
That's right deguix.

First time the user reaches the CustomPage, several 'default' values are given. The user can accept these values (in this case the 'default' values are given back and written to an ascii-file).
If the user enters some other values, the new ones should be written to that file. If the user deletes one (or even more) the default values should be written.

Chris
Mosestycoon is offline   Reply With Quote
Old 24th March 2003, 10:57   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You don't need to use search & replace, use the MUI_INSTALLOPTIONS_WRITE macro.
Joost Verburg is offline   Reply With Quote
Old 24th March 2003, 11:43   #8
Mosestycoon
Senior Member
 
Mosestycoon's Avatar
 
Join Date: Feb 2003
Location: outter space
Posts: 139
Send a message via ICQ to Mosestycoon
Joost -

"Ich verstehe im Moment nur Bahnhof!"

So if I get back the value from a "type=text" field how can I replace a default value in an ascii-file?

e.g.:
-----ascii-file-before----

....(more lines before)...

@@ServerName@@

....(more lines behind)...

-------------------
This is the written down value awaiting a new value given back with "type=text". If the user writes www.acme.tld the result should look like this

-----ascii-file-afterwards----

....(more lines before)...

ServerName www.acme.tld

....(more lines behind)...

-------------------

Understood what I mean?
Chris
Mosestycoon is offline   Reply With Quote
Old 24th March 2003, 13:31   #9
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Never mind, I thought you were talking about an INI file. Just use the search & replace function
Joost Verburg is offline   Reply With Quote
Reply
Go Back   Winamp 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