Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 22nd December 2006, 02:35   #1
easthero
Junior Member
 
Join Date: Dec 2006
Location: Shanghai,China
Posts: 12
how to change the browse button text of the dirrequest control

in custom page,I create a dirrequest control,
the browse button has no text,only three dot,I want to change these three dot to text,such as "click here to browser"

thanks
easthero is offline   Reply With Quote
Old 22nd December 2006, 10:48   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You'll have to work some magic to do that, since InstallOptions doesn't support it. You'll have to call SetWindowPos using the System plug-in to set the button's size and then use SendMessage with WM_SETTEXT to set the new text.

These should help:

http://nsis.sourceforge.net/Moving_i..._of_the_screen
http://nsis.sourceforge.net/Change_c...ler_at_runtime

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 3rd January 2007, 20:01   #3
NewDevToNsis
Junior Member
 
Join Date: Dec 2006
Posts: 2
Hi Kichik or anybody,

Sorry I am very new to write NSIS scripts. I’ve the same problem, too. Can anybody help?

I don’t quite understand what is “call SetWindowPos using the System plug-in to set the button's size” and “use SendMessage with WM_SETTEXT to set the new text”

I only know how to use SetWindowPos for setting the Window position? How can it set the button position?

According to the example provided in http://nsis.sourceforge.net/Change_...ller_at_runtime
Like:

SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:We are waiting... [Section 1]"

The SendMessage and WM_SETTEXT only set the heading of the window. I try to set it to DirRequest, it is not working.

Would you mind explaining more about how to do so?

Thanks for your help.
NewDevToNsis is offline   Reply With Quote
Old 3rd January 2007, 21:46   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Alternatively you may use the function BrowseForFolder somehow like in the following example.
The function BrowseForFolder spreads around the forum with some examples as well.

code:
Name "My Application"
OutFile 'test.exe'
LicenseData '${NSISDIR}\License.txt'
LicenseBkColor 0xFFFFFF
ShowInstDetails show

!include WinMessages.nsh

Page License
Page Custom CustomCreate CustomLeave
Page InstFiles

Section "boo"
SetOutPath '$INSTDIR'
SectionEnd

Function CustomCreate
WriteIniStr '$PLUGINSDIR\custom.ini' 'Settings' 'NumFields' '2'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Type' 'Text'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Left' '5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Top' '36'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Right' '166'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Bottom' '48'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Flags' 'READONLY|NOWORDWRAP'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'State' ''

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Type' 'Button'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Left' '174'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Top' '35'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Right' '-5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Bottom' '49'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Flags' 'Notify'
; WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'State' ''
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Text' 'This button really sucks'

push $0
InstallOptions::InitDialog /NOUNLOAD '$PLUGINSDIR\custom.ini'
pop $0
ReadINIStr $1 "$PLUGINSDIR\custom.ini" "Field 1" "HWND"
SetCtlColors $1 0x000000 0xFFFFFF
InstallOptions::Show '$PLUGINSDIR\custom.ini'
pop $0
pop $0
FunctionEnd

Function CustomLeave
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Settings' 'State'
StrCmp $0 '2' 0 next

Call BrowseForFolder
StrCmp $3 '' _abort

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'State' '$3'
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Field 1' 'HWND'
SendMessage $0 ${WM_SETTEXT} 0 'STR:$3'
_abort:
Abort

next:
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Field 1' 'State'
StrCmp $0 '' 0 exit
MessageBox MB_OK|MB_ICONEXCLAMATION "Plz browse for a folder"
Abort
exit:
StrCpy '$INSTDIR' '$0'
FunctionEnd

Function BrowseForFolder
System::Store "s r9"

; BrowseInfo structure
System::Call '*(i $HWNDPARENT, i 0, t "", t r9, i 0x45, i 0, i, i) i.r1'
System::Call 'shell32::SHBrowseForFolderA(i r1) i.r2'
System::Free $1

; now we should determine folder name from given PIDL
System::Call 'shell32::SHGetPathFromIDListA(i $2, t "" r3)'

; IMalloc->Free work
System::Call 'shell32::SHGetMalloc(*i . r4)' ; Get the pointer to interface
; IMalloc->Free call
System::Call '$4->5(i r2)'
; IMalloc->Release
System::Call '$4->2()'

System::Store "p3 l"
FunctionEnd

Function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 '$PLUGINSDIR\custom.ini'
FunctionEnd


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 3rd January 2007, 23:17   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I did this quite a while ago:
http://forums.winamp.com/showthread.php?threadid=245878

-Stu
Afrow UK is offline   Reply With Quote
Old 5th January 2007, 16:05   #6
NewDevToNsis
Junior Member
 
Join Date: Dec 2006
Posts: 2
Talking

Thank you. It's working.
NewDevToNsis 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