|
|
#1 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
Custom InstType
I'm looking to allow the end user the ability to select install types from the drop down list OR enable them to select the sections from the component list. The selection from the drop down corresponds to the section checked in the component list...they're one and the same (you can liken it to a 1-1 relationship). So, I've included the custom insttype, and used the logic from the one-section.nsi example. This works fine, except I really don't need the "Custom" option appearing in the insttype drop down list. How do I remove this value and still have the user do EITHER/OR: EITHER select from the drop down list OR check the section from the components box? I am aware that I can just have the drop down list and eliminate the component list, but the client desires to have both available.
|
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Selection in the components tree is disabled when you use InstType /NOCUSTOM. You can hack around this by setting the Custom text to nothing or even removing it from the drop down by sending CB_DELETESTRING.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
Thanks for your prompt response. Your first suggestion is an option I can use, however, I'd rather your second suggestion. It's cleaner. The only thing is, I'm not sure how to go about sending the CB_DELETESTRING message out for the drop down combo box. Do you have an example I can work with? I attempted the following in the .onInit function, but it failed to render correct results:
----------------------------------- Push $R0 FindWindow $R0 "#32770" "" $HWNDPARENT GetDlgItem $R0 $R0 1017 SendMessage $R0 ${CB_DELETESTRING} -1 "STR:Custom" Pop $R0 ------------------------------------ What am I doing wrong? Appreciate your help in this regard. |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
That piece of code should work, only it should be called when the dialog is visible and not in .onInit. You should call it in the show callback function of the components page. Try MessageBox'ing $R0 to make sure you get the correct handle. You can also hide the window using ShowWindow to verify.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
I just can't get this to work...I appear to be retrieving the incorrect item_id. How do I get the correct item_id of the combo box? Plus, how do I get to the "show" callback function of the components page? Once again, thanks for your help in this matter.
|
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
You're using the correct control identifier. But that won't help you if you're not calling it in the proper context which is the show callback function. If you don't call it from there, the dialog and the control itself don't even exist.
I'll assume you're using the MUI and therefore you need MUI_PAGE_CUSTOMFUNCTION_SHOW. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
Thanks! That helps...one thing though, when do I declare this function? After !define MUI_STARTMENUPAGE statement and before !define MUI_FINISHPAGE_NOREBOOTSUPPORT? I inserted it before the below and got a compile error.
;-------------------------------- ;Modern UI Configuration !define MUI_WELCOMEPAGE !define MUI_COMPONENTSPAGE !define MUI_DIRECTORYPAGE !define MUI_STARTMENUPAGE !define MUI_FINISHPAGE_NOREBOOTSUPPORT !define MUI_ABORTWARNING !define MUI_UNINSTALLER !define MUI_UNCONFIRMPAGE ; !define MUI_COMPONENTSPAGE_NODESC ;-------------------------------- |
|
|
|
|
|
#8 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
As the Modern UI readme states, right before inserting the components page macro.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
The thing is I don't have "!insertmacro MUI_PAGE_COMPONENTS" macro inserted anywhere in my NSI file...(I inherited this file from an ex-developer). Therefore, I attempted the below:
;-------------------------------- ;Modern UI Configuration !define MUI_WELCOMEPAGE !define MUI_PAGE_CUSTOMFUNCTION_SHOW delete_customstring Function delete_customstring Push $R0 FindWindow $R0 "#32770" "" $HWNDPARENT GetDlgItem $R0 $R0 1017 SendMessage $R0 ${CB_DELETESTRING} -1 "STR:Custom" Pop $R0 FuncionEnd !define MUI_COMPONENTSPAGE !define MUI_DIRECTORYPAGE !define MUI_STARTMENUPAGE !define MUI_FINISHPAGE_NOREBOOTSUPPORT !define MUI_ABORTWARNING !define MUI_UNINSTALLER !define MUI_UNCONFIRMPAGE ;!define MUI_COMPONENTSPAGE_NODESC ;-------------------------------- and still got a compile error. The version of Nullsoft I have is 2.0b3. |
|
|
|
|
|
#10 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
2.0b3? That's older than me...
![]() You'd have to look in your version's readme file for the definition of this function or upgrade. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Oct 2007
Posts: 6
|
Kichik:
Thanks a bunch for all your help! I finally got it to work! This is what was needed (the SendMessage wparam parameter needs the index of the item to be deleted from the combo box): ------------------------------ ;Modern UI Configuration !define MUI_WELCOMEPAGE !define MUI_COMPONENTSPAGE !define MUI_CUSTOMFUNCTION_COMPONENTS_SHOW myCustomFunc Function myCustomFunc Push $R0 FindWindow $R0 "#32770" "" $HWNDPARENT GetDlgItem $R0 $R0 1017 ;ShowWindow $R0 ${SW_HIDE} SendMessage $R0 ${CB_DELETESTRING} 3 "STR:Custom" Pop $R0 FunctionEnd ----------------------------- Once again, thanks for helping me see the light at the end of the tunnel. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|