jrlarkin87
30th July 2010 22:38 UTC
NSIS OnChange
Hey All,
I am a Java/C# coder that has been pushed into the NSIS world and require some assistance. I currently have an Installer screen that sets values in a Drop box(drop list) during the show page method. When that list is changed I need to use another function to get another value to set for a different field. To Simplify I need to set a new field based off of what the old field is without going to a knew page. I need to simulate an onchange in NSIS I am using the ini pages so I cant use the nsDialog::OnChange. Can someone please help to direct me in the right direction even if its only better documentation.
Thanks,
Afrow UK
30th July 2010 22:51 UTC
You have to use nsDialogs.
Stu
jrlarkin87
30th July 2010 23:14 UTC
Is that possible with the ini visual editor stuff in eclipse?? Can I use nsDialog to take control of a pre-existing field?? Sorry for my lack of knowledge on the subject, but I have yet to find any good references for NSIS other then the forums.
jrlarkin87
30th July 2010 23:38 UTC
So I made a little progress I guess your supposed to use like a NOTIFY flag not sure how to use it yet, but seems to be the key.
Animaether
31st July 2010 02:23 UTC
in theory if nothing else you should be able to use the NSD_OnChange functionality with a dialog built originally from InstallOptions(2/Ex) - as long as you set the OnChange event -before- the page is displayed. You can get the hwnd of the control (Which you'll need for the OnChange) out of the INI after initialization
However.. I'd recommend re-building the page with nsDialogs entirely. There's already an example that's similar to the sort of thing you would need:
http://nsis.sourceforge.net/Move_data_between_ListBoxes
If you do insist on continuing with InstallOptions(2/Ex), then you do indeed need the NOTIFY flag on the droplist control. I'm not sure if the original InstallOptions supports it on that control so you might have to switch to InstallOptionsEx. Once the NOTIFY event works correctly, the page's Leave function will be triggered - at which point you'll have to read the INI file and read the state of the page to see which user action triggered that leave event.
jrlarkin87
2nd August 2010 18:25 UTC
Hey Guys,
Thanks for the replies so far. So I figured out how to use the flag to an extent. I can then use a switch statement to determine what action to take. I am having a new problem though!? The flag sends me to the Leave Page Function. I read that Choice A was changed, and based on the information from Choice A I write a new selection for Choice B. However, after it shows a message box(which I have used to verify that the function I desired was indeed being called). It doesn't change choice B as it should. Currently the code is simply using the MUI_OPTIONS_WRITE macro... Any Suggestions on what to do in order to get the changes to stick when it aborts the leave page function?
jrlarkin87
2nd August 2010 19:28 UTC
Noticed Something if I set off the flag, it writes the changed value and I hit next. Once I go back to the page it suddenly shows up?
jrlarkin87
2nd August 2010 23:05 UTC
Hey,
Alright I am getting better results using GetDlgItem and then I can set text boxes with SW_SETTEXT. Id like to know what WinMessaging has for populating the droplist and setting its state? Is it as simple as SETState? EW that sounds good ill try that lol if there are any more solid answers please let me know!
P.S: I now know more about NSIS then I ever wanted to know!
Thanks,
J