Archive: progressbar manipulation


progressbar manipulation
  Is it possible to manipulate the progressbar to increase / decrease the space for a certain section of the de-, installer progress?


:up:

It is possible. But you need to do this inside a function (but this function can be called from a section), because when you put this code in a section, it doesn't work (NSIS sets the progress indicator bar position value everytime when passing by a command):

!define PBM_SETPOS 0x0402

># !define PBM_DELTAPOS 0x0403

# Use PBM_DELTAPOS if you want to increment,
# not to set, the value.

>Section

># Other things

>FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1004

Call ChangeProgressIndicatorBarPosition

># Other things

>SectionEnd

>Function ChangeProgressIndicatorBarPosition

StrCpy$0 50 # Set indicator bar in position "50%"

>IntOp $0 $0 * 300

SendMessage $R0${PBM_SETPOS} $0 ""

># If you want to see the show above, put a
# MessageBox command after the command above,
# so it doesn't disappear, until you click OK.

# OR if you want to increment, not to set, the new
# position, you can use ${PBM_DELTAPOS}.

# SendMessage $R0 ${PBM_DELTAPOS} $0 ""

>FunctionEnd
>

is there any way to display the progress bar like the "xp-progress bar"?
i read some threads but i wasn't able to find out exactly if it's possible...


It will use the XP-style progress bar when you are using Windows XP.


If you are not using MUI then make sure you have XPStyle on at the start of your script (MUI includes this automatically), but, of course, only when installing on XP will this have an effect.


and is there any way to make something like this [attached file]


Yes, create a UI file with a custom dialog and use window messages.


is there a manual "how to create a UI file with a custom dialog and window messages for dummys"? :D


No. Get a resource editor to modify the UI file and search MSDN for information about window messages to use.


ok.
one more question...
do you know a simple resource editor?
and which file is the ui file
[i'm a total greenhorn]


See the Modern UI Readme.

Custom pages > Customize standard dialogs


ok I was able to make 5 checkboxes in the modern.exe [for me this is no mean feat :D ]
now the next step is to set the caption of the checkbox.
[name of section 1 is caption of checkbox 1, ...]
I rumaged many sites, but I'm still planless... [I know I'm a little nerving] :(


Use the WM_SETTEXT message with a string.


first i tried it with a sample from the archive:


    GetDlgItem $R0 $HWNDPARENT 3

SendMessage $R0${WM_SETTEXT} 0 "STR: pOiSoN"
MessageBox MB_OK "HWNDPARENT: $HWNDPARENT"
MessageBox MB_OK "R0: $R0"
and this worked.

then i opened the ressource hacker and I assigned the checkbox the id 3333.
    GetDlgItem $R0 $HWNDPARENT "#3333"

SendMessage $R0 ${WM_SETTEXT} 0 "STR: pOiSoN"
MessageBox MB_OK "HWNDPARENT: $HWNDPARENT"
MessageBox MB_OK "R0: $R0"
but it doesn't work.

do you know whats my failure?

It's clear why that's happening because you did put "#3333", not the correct "3333".


If it's on the inner dialog you'll have to use the handle of that dialog. See users manual section 4.9.14.6.


ok thank you very very much joost
respect to you patience ;-)

this is the working code [only 3 lines, i can't take it ~gg~]

Var window


Section"Hauptgruppe" SEC01FindWindow $window "#32770" ""

>FindWindow $window "#32770" "" $HWNDPARENT
GetDlgItem $R0 $window "3333"
>SendMessage $R0 ${WM_SETTEXT} 0 "STR: textofthecheckbox"

hi again :rolleyes:
i opened the

List of common Windows Messages
By KiCHiK
file

with which option am I able to change the status of the checkbox [checked/unchecked]?

It's not in that list. See MSDN or http://forums.winamp.com/showthread....hreadid=175303


so, now everything works...

i have 5 checkboxes and i am able to "check" or "uncheck" them... great :p
i don't know if its necessary to post my code. shall i?¿


Yes, it's always useful for others.


ok it's not really elaborate...

first i made 5 checkboxes [with a resource editor: "Resource Hacker"][into the modern.exe]
then i gave them the ids "3333", "3334", "3335", "3336" & "3337".

so, now i had to set the captions...
first you have to set a variable [in my code it is $InstallWindow]

Var InstallWindow


Section"createWindow" SEC01
>;1st
FindWindow $InstallWindow"#32770" "" $HWNDPARENT
GetDlgItem $R0 $InstallWindow "3333"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: Caption1"
>;2nd
GetDlgItem $R0 $InstallWindow "3334"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text2"
>;3rd
GetDlgItem $R0 $InstallWindow "3335"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text3"
>;4th
GetDlgItem $R0 $InstallWindow "3336"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text4"
>;5th
GetDlgItem $R0 $InstallWindow "3337"
SendMessage $R0 ${WM_SETTEXT} 0 "STR: Text5"
>SectionEnd
>
So now i can check/uncheck any box with


GetDlgItem $R0 $InstallWindow "3333"

>SendMessage $R0 ${BM_SETCHECK} ${BST_CHECKED} ""

>GetDlgItem $R0 $InstallWindow "3335"
>SendMessage $R0 ${BM_SETCHECK} ${BST_UNCHECKED} ""

hi

can someone give me a working example script, please?


gerne...


danke sehr! :D


so now I have a little problem [its not really important...]

i had the captions of the ckeckboxes in a languages.nsh
[

LangString CUSTOM_INSTFILES_CHECKBOX_FIRST${LANG_GERMAN} "Ein Männlein steht im Walde ganz still und stumm, Es hat von lauter Purpur ein Mäntlein um. Sagt, wer mag das Männlein sein, Das da steht im Wald allein. Mit dem purpurroten Mäntelein. " 
]

i read somewhere here that i have to include this language file at the bottom...
no problem...until i tried to uninstall this...

i think that the language.nsh isn't include...
what can i do?

Use an uninstaller langauge string (.un prefix) for the uninstaller.


oh, thx


and it goes on...

is there a way to make the caption of a checkbox bold?
i looked in the winmessages.nsh, but havent found what i need...


WM_SETFONT / CreateFont


ok in my example this is...


    CreateFont $2 "Tahoma" 10 700

SendMessage $R0${WM_SETFONT} $2 0
>

but i am not able to make the first caption "bold" then the second......

if i use WM_SETFONT 2 times only the last executes


ok now i use "createfont" 5 times... it works [obviously you can't use one font for more than one caption]