Old 10th November 2005, 15:12   #1
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Add stuff to a form

I'd like to add a label or a text box into the form which shows the destination folder to install, but I don't know how? Please help. thanks.
anvinh173 is offline   Reply With Quote
Old 10th November 2005, 20:09   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Why not set the text using DirText? You can add multiple lines using $\r$\n.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 10th November 2005, 23:00   #3
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
I meaned I want to add another DIRREQUEST box into dir-page (original page which comes with NSIS package).
anvinh173 is offline   Reply With Quote
Old 10th November 2005, 23:35   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
You'll have to create a custom one using InstallOptions or InstallOptionsEx. The first is documented and available from the NSIS help, the latter you can find a discussion on here :
http://forums.winamp.com/showthread.php?threadid=181087
Animaether is offline   Reply With Quote
Old 10th November 2005, 23:38   #5
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
By the way.. I've done a directory page with two directory fields - it's a bit intricate and has a few 'hacks' to get things looking well. I would recommend using InstallOptionsEx instead of InstallOptions for this.

Two reasons that pop into mind:
1. you can get a NOTIFY event from a user changing the directory path - you can't with InstallOptions (only when going through the browse button, and technically that's not supported - but hey, it works)

2. you can specify the text of the browse button (defaults to "...") - can't do that in InstallOptions, so you have to set the text on the control manually, re-size the control, move it to the left, an then re-size the directory path textbox control to fit. Totally doable, but not preferable
Animaether is offline   Reply With Quote
Old 17th November 2005, 14:47   #6
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
thank you very much.
I have a droplist on my custom page, and I used GetDrive to get all available drives on my computer. How to list all drives under listItems of droplist (it means when I click the arrow of droplist, it displays drives so I can select one). Thank you
anvinh173 is offline   Reply With Quote
Old 17th November 2005, 15:44   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You need to write to ListItems with WriteINIStr before showing the page. The value that you write should be in the format "str1|str2|etc"

-Stu
Afrow UK is offline   Reply With Quote
Old 21st November 2005, 21:29   #8
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
thanks
when I call GetDrive "ALL" "FunctionName", in FunctionName I got drive in $9 and drive type in $8, and I have more than 4 dif. drives, how can I write these drives to my droplist. Please help, thanks
anvinh173 is offline   Reply With Quote
Old 21st November 2005, 22:22   #9
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
PHP Code:
Function SomePrePageFunction
# clear variable R9, just in case
# we'll be using it to store the list of drives
StrCpy $R9 ""
# call the GetDrives function
${GetDrives"ALL" "CallBackFunc"
# $R9 now contains e.g. "|C:\|D:\|E:\"
# chop the first "|" off
StrCpy $R9 $R9 -1 1
# now you have a list of drives in the format a listbox requires

# if you're using MUI, you can then write it to your
# InstallOptions file using the following:
!insertmacro MUI_INSTALLOPTIONS_WRITE "InstallOptions.ini" "Field 1" "ListItems" $R9
# please keep in mind that you need to put in the correct ini filename
# and the correct Field number

# initialize the dialog
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "InstallOptions.ini"
# and show it
!insertmacro MUI_INSTALLOPTIONS_SHOW
SectionEnd

Function CallBackFunc
  
# add the drive to the drives list
  
StrCpy $R9 "$R9|$9"
  
Push $0
FunctionEnd 
Animaether is offline   Reply With Quote
Old 22nd November 2005, 14:43   #10
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Thank you very much. I really appreciate your help.
anvinh173 is offline   Reply With Quote
Old 6th December 2005, 14:45   #11
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
I have a custom page, in there I have a DirRequest control, and I want to change the text of Browse button. This is what I did, but it didn't work:
GetDlgItem $1 $HWND 1200
SendMessage $1 ${WM_SETTEXT}1 "STR:Browse"
When I compile, this gives me a warning and ignore the line GetDlgItem because it doesn't recognize the constant HWND. What should I do? Thanks.
anvinh173 is offline   Reply With Quote
Old 6th December 2005, 14:56   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1200
SendMessage $R1 ${WM_SETTEXT} 1 "STR:Browse"

$HWND is a variable not a constant that you'd have to define yourself.

-Stu
Afrow UK is offline   Reply With Quote
Old 6th December 2005, 20:42   #13
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
I got it. Thank u very much. Can you show me how to resize the browse button of DirRequest? (since after I change its text from "..." to "browser", it doesn't not display right) thanks.
anvinh173 is offline   Reply With Quote
Old 6th December 2005, 23:14   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You need to use Resource Hacker for that. Search Google.

-Stu
Afrow UK is offline   Reply With Quote
Old 7th December 2005, 14:40   #15
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
I got it. Thank you.
I have a DirRequest on a custom page, when I click browse button it displays browser window, is there any way that I can add text to this window (below the title "Browse for folder")? thanks.
anvinh173 is offline   Reply With Quote
Old 7th December 2005, 14:52   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
The Text= attribute changes that for DirRequest controls.

-Stu
Afrow UK is offline   Reply With Quote
Old 7th December 2005, 15:04   #17
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Thank you very much Afrow.
anvinh173 is offline   Reply With Quote
Old 8th December 2005, 00:39   #18
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Custom page

I have a DIrRequest on a custom page. Right after I click OK button on the browser window, is there any way that I can get the selected path, so I can modify it, and display a message box to user before it (selected path) is displayed on the text box of DirRequest? Thanks
anvinh173 is offline   Reply With Quote
Old 8th December 2005, 15:03   #19
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
I have a DIrRequest on a custom page. Right after I click OK button on the browser window, is there any way that I can get the selected path, so I can modify it, and display a message box to user before it (selected path) is displayed on the text box of DirRequest? Thanks
anvinh173 is offline   Reply With Quote
Old 8th December 2005, 16:53   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
All the InstallOptions examples show you how to validate input on an InstallOptions page.
Tip: From the Leave function with ReadINIStr (DirRequest>State). To go back to a page, call Abort from the pages' Leave function.

-Stu
Afrow UK is offline   Reply With Quote
Old 8th December 2005, 20:17   #21
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Thank you Afrow UK.
anvinh173 is offline   Reply With Quote
Old 9th December 2005, 02:08   #22
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
validate the selected dir

I think I didn't state clearly my problem before. This is it: I have a DirRequest on a custom page. I click browse button-> browser window appears-> I select a dir ( C:\ProgramFiles)-> I click OK on browser window-> the selected dir (C:\ProgramFiles) is displayed on text box of dirRequest, but I don't want this, I want to change C:\ProgramFiles to C:\balba and display a message-> and user click OK button on the message wind.-> then new path(C:\balba)is displayed on the text box of dirRequest. It means somehow I can read and modify the selected path before it is displayed on the textbox of DirRequest control. I have tried many times in many ways, couldn't do it. Please help. Thank you.
anvinh173 is offline   Reply With Quote
Old 9th December 2005, 10:39   #23
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use Flags=NOTIFY
This will act like the user clicking next when he clicks OK (on the browse window) but the field number of the DirRequest control will be written to Settings>State which you can check with ReadINIStr. For examples see Examples\InstallOptions\NotifyTest.nsi

-Stu

-Stu
Afrow UK is offline   Reply With Quote
Old 12th December 2005, 15:13   #24
anvinh173
Junior Member
 
Join Date: Nov 2005
Posts: 14
Thank you very much. I got it. Really appreciate your help.
anvinh173 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