Hi!
I just created my first new page using nsDialogs and I have a few issues...
The first one is that I want to create a list box but and I was wondering if there is a way to have two values for each entry, one for display and the other one would be returned when I get the selection.
For example the displayed value could be name of a country while the return value would be its country code.
Is there any way to do that?
My other question is about the position of the different labels on a Modern UI 2 page, is there any way to know what it is so that I can use the same positions in my new page?
Thank you and have a nice day!
Nick
Some questions about creating a new page...
5 posts
1) Use the LB_GETITEMDATA and LB_SETITEMDATA messages (More info on MSDN)
2) Look in \NSIS\Contrib\Modern UI 2\Pages
2) Look in \NSIS\Contrib\Modern UI 2\Pages
Thank you very much Anders!
It tried something like this:
${NSD_LB_AddString} $ListBox_division "$(DIVISION_EAST)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 0 "STR:east"
${NSD_LB_AddString} $ListBox_division "$(DIVISION_WEST)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 1 "STR:west"
${NSD_LB_AddString} $ListBox_division "$(DIVISION_BOTH)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 2 "STR:both"
${NSD_LB_SelectString} $ListBox_division "$(DIVISION_EAST)"
It didn't complain but I am not sure I did it ok...
The thing I am most doubtful of is where I get it:
Function nsDialogsPageLeave
;${NSD_LB_GetSelection} $ListBox_division $division
SendMessage $ListBox_division ${CB_GETITEMDATA} 0 $division
FunctionEnd
Is that how I should do that? I doubt it since it doesn't work and complain about division being unused...
Thank you very much and have a nice day!
Nick
I think I understand the idea but I don't know how to do it since I am not familiar enought with Windows APIs and NSIS...Originally Posted by Anders View Post1) Use the LB_GETITEMDATA and LB_SETITEMDATA messages (More info on MSDN)
It tried something like this:
${NSD_LB_AddString} $ListBox_division "$(DIVISION_EAST)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 0 "STR:east"
${NSD_LB_AddString} $ListBox_division "$(DIVISION_WEST)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 1 "STR:west"
${NSD_LB_AddString} $ListBox_division "$(DIVISION_BOTH)"
SendMessage $ListBox_division ${CB_SETITEMDATA} 2 "STR:both"
${NSD_LB_SelectString} $ListBox_division "$(DIVISION_EAST)"
It didn't complain but I am not sure I did it ok...
The thing I am most doubtful of is where I get it:
Function nsDialogsPageLeave
;${NSD_LB_GetSelection} $ListBox_division $division
SendMessage $ListBox_division ${CB_GETITEMDATA} 0 $division
FunctionEnd
Is that how I should do that? I doubt it since it doesn't work and complain about division being unused...
The only page I could see absolute positionings is the welcome page... I don't know NSIS well enough to understand how the positioning is done in the other pages (like the component one for example).Originally Posted by Anders View Post2) Look in \NSIS\Contrib\Modern UI 2\Pages
Thank you very much and have a nice day!
Nick
SendMessage $mycontrol ${LB_GETITEMDATA} $itemindex 0 $outputgoeshere but I don't remember if you can store strings there or just numbers. (Don't mix LB and CB messages)
Only the Welcome and Finish pages use nsDialogs, the others are NSIS built-in pages. The resource scripts for those are @ https://sourceforge.net/p/nsis/code/...k/Contrib/UIs/
Only the Welcome and Finish pages use nsDialogs, the others are NSIS built-in pages. The resource scripts for those are @ https://sourceforge.net/p/nsis/code/...k/Contrib/UIs/
Hi Anders!
Is there a way to remap those numbers to the strings I passed or those messages are simply unable to handle strings at all?
I was initially searching for examples of using LB_SETITEMDATA in NSIS but when I did not found any I started searching for examples for any type of control...
When came time to add those lines I had both type of control messages (list box and combo box) mixed up...
As for the list box problem, at this point even though I don't find that clean I am tempted to do that list box the usual way (without those added SendMessage), get the selected value using ${NSD_LB_GetSelection} and then remap those display values back to the codes I need using multiple ifs or a case...
Thank you very much and have a nice day!
Nick
I am just getting numbers out of this and no string even though I passed strings to LB_SETITEMDATA...Originally Posted by Anders View PostSendMessage $mycontrol ${LB_GETITEMDATA} $itemindex 0 $outputgoeshere but I don't remember if you can store strings there or just numbers.
Is there a way to remap those numbers to the strings I passed or those messages are simply unable to handle strings at all?
Thank you!Originally Posted by Anders View Post(Don't mix LB and CB messages)
I was initially searching for examples of using LB_SETITEMDATA in NSIS but when I did not found any I started searching for examples for any type of control...
When came time to add those lines I had both type of control messages (list box and combo box) mixed up...
Unfortunately I don't know how to read this and I don't have the time to learn it at this time (I spent waaaaaaay too much time on this, something which I thought would be much simpler to do) so I will just do my best approximation as far as positioning is concerned...Originally Posted by Anders View PostOnly the Welcome and Finish pages use nsDialogs, the others are NSIS built-in pages. The resource scripts for those are @ https://sourceforge.net/p/nsis/code/...k/Contrib/UIs/
As for the list box problem, at this point even though I don't find that clean I am tempted to do that list box the usual way (without those added SendMessage), get the selected value using ${NSD_LB_GetSelection} and then remap those display values back to the codes I need using multiple ifs or a case...
Thank you very much and have a nice day!
Nick