Old 11th October 2017, 23:38   #1
Junior Member
Join Date: May 2015
Posts: 9
Force window/page/control redraw

Hey guys. I am using this plugin and have a following problem with it:

If you open directory selection dialog - the scrollbar is not being drawn unless you expand some folders and on instfiles page after install is done, close button remains grayed-out.
Pressing "show details" button whatever during or after install reveals the button. Moving the window offscreen or making it redraws makes it appear as well.

Note that if installer finished too fast - the problem may not appear so make sure to add something like Sleep 3000 if you are willing to try it out.

Now I realize that this might be an issue with the plugin itself, but I don't have a faith that it will be resolved in a reasonable timeframe, if at all. Also I want to note that other NSIS UI plugins such as UMUI have/had similar issues.

So what do I want? I would like you to suggest some workaround/hack to make the button work properly. At least for the cancel button.
Maybe something like user32::RedrawWindow or user32::UpdateWindow can help if executed properly? (Because the state of the button is correct, it is disabled only visually)

Any ideas? You can use Basic.nsi from NSIS MUI2 examples, the script contents are really not making any difference here.
Endy-kun is offline   Reply With Quote
Old 12th October 2017, 02:01   #2
Anders's Avatar
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,944
Even if it seems trivial you should post minimal example code in cases like this. It is also important to inform us about your Windows version and which Windows theme/visual style you are using (if applicable).

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 12th October 2017, 02:25   #3
Junior Member
Join Date: May 2015
Posts: 9
Yea I wanted to add more information but did not expected that premoderation is on.
I also forgot to mention that I am not showing final page at all. If I do, it is not a problem since all buttons on it work fine.
Lastly I managed to solve the issue with the button using that wiki page that shows how to enable cancel button (just with a different ID). I tried to do this before but it appears that my own approach to enable it wasn't working. Code is below.

So now I only have the issue with a scrollbar.
What we do: On directory page open folder select dialog and assume that we have more folders that fit the window
What we see: Mouse wheel doesn't scroll anything and the scrollbar is missing
What we do next: Click on some triangles to expand folders
What happens: Mouse wheel now works and scrollbar magically appears

I don't think this can be solved just as easy. Perhaps I shoudl try to replace the whole dialog with my own... Didn't have much success with that yet but perhaps due to lack of a know-how also.

Unicode true
!include "MUI2.nsh"
Name "Modern UI Test"
OutFile "Basic.exe"
RequestExecutionLevel admin
!insertmacro MUI_LANGUAGE "English"
InstallDir "C:\Desktop\NSISTEST\"

Section "Dummy Section" SecDummy
SetDetailsPrint both
SetOutPath "$INSTDIR"
Sleep 3000
#Call fff


Function fff
Push $R0
GetDlgItem $0 $HWNDPARENT 1
# This will make the button look correct. It shouldn't be needed but it is...
# I want to mention again that it only looks disabled but can be pressed and becomes normal onmouseover
# but still it is confusing for the end user so had to find a solution
EnableWindow $0 1
Pop $R0

Function .OnInit
File /oname=$PLUGINSDIR\anystyle.vsf "resources\anystyle.vsf"
NSISVCLStyles::LoadVCLStyle $PLUGINSDIR\anystyle.vsf

Endy-kun is offline   Reply With Quote
Old 12th October 2017, 02:33   #4
Junior Member
Join Date: May 2015
Posts: 9
I just noticed that in the 1st post I mentioned Cancel button. It was a mistake. Cancel is disabled by design, that I know. I meant to say "Next" button, which in my case acts as the last button user will press since I don't show final page.
Endy-kun is offline   Reply With Quote
Old 12th October 2017, 18:03   #5
Junior Member
Join Date: May 2015
Posts: 9
Well I tried to replace dialogs. For some reason custom-created ones are only partially skinned and still have the issue. Vista-style dialog from the wiki came close but its address bar is not skinned and there are some other minor issues. I wish there was a way to disable style for this open folder dialog... (or at least for the treeview element). Maybe there is? Not sure how do I get the handles of a dialog that is not yet created and how do I execute the code before the section, before moving away from the page but after page is fully loaded...
Endy-kun is offline   Reply With Quote
Old 12th October 2017, 18:16   #6
Junior Member
Join Date: May 2015
Posts: 9
Sorry for so many messages. There doesn't appear to be an edit button.

I was naively thinking that mouse wheel not working when dialog pops up is a plugin/style issue but it appears that if we'll comment out oninit code above, it will be just the same with unskinned NSIS. Yes the scrollbar is shown, but mouse wheel is not working till you click something.

Well, guess I'll have to ditch that dialog after all and go with vista-style one. Not sure why it is not yet the default anyway.
Endy-kun is offline   Reply With Quote
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