- NSIS Discussion
- Small bug
Archive: Small bug
Afrow UK
29th September 2004 14:02 UTC
Small bug
I've found that if you change the text colour of a Label control, and then try and change the text within it the new text appears over the old text and doesn't actually replace it.
Screenshot attached.
A similar thing happens when changing the background colour of e.g. a ListBox control. The background color isn't set for the whole ListBox background, but when you select an item the background colour of that item is set to the new background colour.
I have found a fix for this which is to hide the control and then show it again using ShowWindow (so basically it refreshes the control).
E.g.
ShowWindow $R0 0
ShowWindow $R0 5
-Stu
kichik
29th September 2004 14:05 UTC
If you set the background to transparent and then set the text, Windows has no color to draw over the old text.
edream
14th October 2005 00:56 UTC
I'm trying to add text in ListBox in Leave page. The ListBox is not getting refreshed. If I use abort or MessageBox followed by it, then I can see the refreshed content.
Is there a way I can refresh the newly added text?
I tried ShowWindow {SW_HIDE} and {SW_SHOW}, but the hidden window never comes back. Here is the snippet
Function tempProgressLeave
; disable back button before showing the progress
GetDlgItem $0 $HWNDPARENT 3
EnableWindow $0 0
; disable next button
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
FindWindow $1 "#32770" "" $HWNDPARENT
GetDlgItem $0 $1 1202
StrCpy $2 0
StrCpy $vard "hello world"
loopd:
IntOp $2 $2 + 10 ;here the progressbar increases
;MessageBOX MB_OK "hello ${SW_SHOW} ${SW_HIDE}"
ShowWindow $0 ${SW_HIDE}
SendMessage $0 ${LB_ADDSTRING} "" "STR: $2:$vard"
ShowWindow $0 ${SW_SHOW}
IntCmp $2 100 loopd loopd
Sleep 5000
FunctionEnd
kichik
15th October 2005 13:41 UTC
Please attach a complete example.
edream
18th October 2005 18:22 UTC
I have attached the sample script. The script just contains welcome-install-finish page. I had to write custom install page to control the progress bar. I'm able to control the progress bar but not able to refresh the listbox.
could you please take a look at the files and let me know if there is something I am missing ?
Thanks.
kichik
20th October 2005 19:45 UTC
I don't see the code from the first post in your example. Attach an example that contains the code you've tried. Also, there are a lot of missing files. It'd be nicer, if you provide a complete minimal example that I can compile with too much hassle.
BTW, to create a .lnk file, use CreateShortcut. Don't copy premade shortcuts over to the user's computer.
edream
21st October 2005 07:26 UTC
The example I tried is in the zip file. I'm not sure what are the missing files. It requires only the dinst.nsi and the DInstall.ini. both files are bundled in the zip file.
I copied the zip file in to the separate directory and I'm able to compile. Could you please let me know what the problem you are facing?
I'm not very clear about the createshortcut suggestion.I dont have any such code. Could you please clarify.
Attaching the zip file again.
Thanks.
Afrow UK
21st October 2005 09:12 UTC
It also needs InstallOptionsEx plugin to be present.
-Stu
deguix
21st October 2005 10:45 UTC
To update the page you can just use this:
System::Call "User32::UpdateWindow(i)i (r0)"
Put that line of code after trying to show back the window.
This should be seen as a feature, not bug. You add an item but you have an option to update them when you really need.
kichik
21st October 2005 14:15 UTC
Oops, sorry. I've opened up another script instead of yours.
edream
21st October 2005 19:54 UTC
Great! It worked with this change.
System::Call "User32::UpdateWindow(i)i (r0)"
Thanks a lot!