Archive: reload page from nsdialogs callback


reload page from nsdialogs callback
I am using the NSDialogs BrowseButton callback macro ${NSD_OnClick} to get the user's input on Tomcat's root directory for webapps.
If the user changes this directory, I want other fields to update, and some to disappear. For example, update will no longer be an option if the new directory doesn't have the installation .war file.
Functionally, I want the entire page to reload as if coming back from its leaving function, or the back button.

any suggestions on how to accomplish this?
....
${NSD_OnClick} $BrowseButton2 GetwebappHome
....
Function GetwebappHome
Exch $R0
${If} $R0 == $BrowseButton2
nsDialogs::SelectFolderDialog /NOUNLOAD "open" $webappsdir
Pop $R0
${If} $R0 != error
StrCpy $webappsdir $R0
${NSD_SetText} $Text_3 $webappsdir ; reset text to new dir
${EndIf}

${Endif}
pop $R0
FunctionEnd


Reloading the entire thing is not exactly possible. But you could hide and show everything with ShowWindow. I suggest you create two functions - ShowUpgradeOption and HideUpgradeOption. Those two will set visibility and other variables of the controls. You can then use those two in both the browse button callback and the function that creates the dialog.


I did try putting the display function into a separate function (though I didn't use show window, i just called it from the callback function, trying to overlay new controls)
It didn't really work that well, and I finally put the control that i wanted to initiate the changes into a previous page.
However, the ability to delete a control and refresh the page would be nice functionality to have.


You don't need to delete it. Simply hide it using ShowWindow.