landaquinn
23rd July 2008 00:26 UTC
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
kichik
23rd July 2008 18:21 UTC
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.
landaquinn
24th July 2008 17:20 UTC
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.
kichik
24th July 2008 17:22 UTC
You don't need to delete it. Simply hide it using ShowWindow.