Thanks Anders, that thread is illuminating!
I need to find out how to Vscroll programmatically. I googled and found a hint about setting the top index with a message, but I haven't fleshed it out yet. Now I'm off to do the Hscroll bar. As regards exporting, I think I will do a simple button.
nsDialogs
173 posts
My installer has a single custom page built with nsDialogs.
Sometimes it doesn't repaint custom page areas that were temporarily covered by another window. What techniques are available to work around this kind of repainting issues?
Specifically, when my installer shows a MessageBox over the custom page title area, when I OK the MessageBox parts of the title area may not be repainted. It also happens with the progress bar control which is placed right below the title area.
Andi it may also happen when I replace the MessageBox with a directory or file browse dialog, after OKing the dialog.
Sometimes it doesn't repaint custom page areas that were temporarily covered by another window. What techniques are available to work around this kind of repainting issues?
Specifically, when my installer shows a MessageBox over the custom page title area, when I OK the MessageBox parts of the title area may not be repainted. It also happens with the progress bar control which is placed right below the title area.
Andi it may also happen when I replace the MessageBox with a directory or file browse dialog, after OKing the dialog.
Hi everybody. I'm new on this forums, but I've been using NSIS for 2 years already. NsDialogs plugin is some awesome thing in the System. So I haven't found any suggestions about my additions so I post 'em here:
(Addressing 2 kichik)
Why don't you add ListView and TreeView support as in InstallOptionsEx?
Thanks, Static_VoiD
(Addressing 2 kichik)
Why don't you add ListView and TreeView support as in InstallOptionsEx?
Thanks, Static_VoiD
Static - just a matter of time/interest/etc. You can always contribute a solution to the Wiki..
..or submit a patch to the repository 🙂
..or submit a patch to the repository 🙂
Yeah, i'm aware of the Plugin's NSDialogs examples section, but I wish I had a native support for the controls mentioned. Just add the ability to create them - i'll take care of the rest 😉 .
The difference between 'native' and another header is a single additional "!include <file>" line ; no more, no less.
Creating them is relatively simple, in fact. Adding e.g. treeview items, getting them, etc. are far more involved (requiring the System plugin). So if you can take care of that, surely a !include can't hurt? 🙂
Creating them is relatively simple, in fact. Adding e.g. treeview items, getting them, etc. are far more involved (requiring the System plugin). So if you can take care of that, surely a !include can't hurt? 🙂
If you mean I can take sources, modify them and compile - that's Great! But you see, i don't have VC compiler 🙁 , and i'm dial-up user :-P . So I want you, Animaether, or anybody else to add the necessary lines and compile the plugin. Can anyone here handle it? I'll appreciate that a lot.
- Edit -
Oh, I see plugin can create what I want (AFAIK, early versions didn't support this trick) ! So the thing is how to manage it? If the NSdialogs.nsh lacks of it, them I'm gonna make it possible 🙂 ! Thanks for replies.
- Edit -
Oh, I see plugin can create what I want (AFAIK, early versions didn't support this trick) ! So the thing is how to manage it? If the NSdialogs.nsh lacks of it, them I'm gonna make it possible 🙂 ! Thanks for replies.
Yay for the edit 😉
Not sure how long it's supported this, but it's been there for some time. Have a peek at, for example:
That's a pretty basic extension of nsDialogs that uses the very same code conventions that all the other nsDialogs controls use in terms of naming, styles, etc. Makes it easier for users/developers to integrate it with their nsDialogs.nsh (although it can be kept separate from it.. it will still depend on nsDialogs.nsh, of course).
In your case, you'd just need to define SysListView32 as the class name and then ponder what styles you might need. You may need to define several classes if some of the styles you're interested in cannot be set after the control has been created; hence why CreateTextMultiline exists - you can't set the multiline style on an Edit control after it has been created.
But, like I said, that's the easy part 🙂 Good luck!
Not sure how long it's supported this, but it's been there for some time. Have a peek at, for example:
That's a pretty basic extension of nsDialogs that uses the very same code conventions that all the other nsDialogs controls use in terms of naming, styles, etc. Makes it easier for users/developers to integrate it with their nsDialogs.nsh (although it can be kept separate from it.. it will still depend on nsDialogs.nsh, of course).
In your case, you'd just need to define SysListView32 as the class name and then ponder what styles you might need. You may need to define several classes if some of the styles you're interested in cannot be set after the control has been created; hence why CreateTextMultiline exists - you can't set the multiline style on an Edit control after it has been created.
But, like I said, that's the easy part 🙂 Good luck!
Yep, I know about that too 🙂 . Another "weird" thing comes to mind: it would be easier to make a plugin which will handle all the operations with getting and setting text into the controls instead of writing .nsh ...Err...I'll give it (.nsh writing) a try anyway 😉 .
Originally posted by NicholiLooks like that's one of those styles that you have to set upon creation (can't use NSD_AddStyle / SetWindowLong trickery; which should get abstracted to an NSD_SetStyle, but anyway), so you would have to use something like:
Are multistate checkboxes now available with nsDialogs? Or rather something as simple as a checkbox with three states: unchecked, checked, and greyed?
Most of that is copied from the existing checkbox code in nsDialogs.nsh, except that BS_AUTOCHECKBOX was replaced with BS_AUTO3STATE.
nsDialogs::CreateControl "Button" ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_MULTILINE}|${BS_VCENTER}|${BS_AUTO3STATE} 0 0 0 100% 8% "Checkbox"
Actually, perusing MSDN some more, it looks like you can set the button style on-the-fly using the BM_SETSTYLE message;
Pretty sure you don't need most of those styles (most are implied, others don't apply to a checkbox-style 'button') and you can just use:
${NSD_CreateCheckbox} 0 0 100% 8% "Checkbox"
Pop $0
StrCpy $1 0
IntOp $1 $1 | ${DEFAULT_STYLES}
IntOp $1 $1 | ${BS_TEXT}
IntOp $1 $1 | ${BS_MULTILINE}
IntOp $1 $1 | ${BS_VCENTER}
IntOp $1 $1 | ${BS_AUTO3STATE}
SendMessage $0 ${BM_SETSTYLE} $1 1
SendMessage $0 ${BM_SETSTYLE} ${BS_AUTO3STATE} 1I suppose negative positions are not supported? ( control doesn't appear to get created at all).
I've got a label that I need to actually have higher up than 0%; the reason for this is that the font used is pretty tall, but the character I need is low - to align it properly, I have to move the very top of that label to a negative Y position (won't hurt as all the label space above that character is blank).
I'll work around it with GetWindowRect and SetWindowPos (naming consistency? pft) probably as I just need to nudge this thing up, but if I'm not missing something, then this might be a good wishlist item:
- allow negative X and Y positions
- allow negative width/height (calculating from the canvas's width/height and subtracting the value from that, so that e.g. moving a control to the left doesn't require you to adjust the width to end up at the same alignment on the right)
I've got a label that I need to actually have higher up than 0%; the reason for this is that the font used is pretty tall, but the character I need is low - to align it properly, I have to move the very top of that label to a negative Y position (won't hurt as all the label space above that character is blank).
I'll work around it with GetWindowRect and SetWindowPos (naming consistency? pft) probably as I just need to nudge this thing up, but if I'm not missing something, then this might be a good wishlist item:
- allow negative X and Y positions
- allow negative width/height (calculating from the canvas's width/height and subtracting the value from that, so that e.g. moving a control to the left doesn't require you to adjust the width to end up at the same alignment on the right)
it already supports negative size AFAIK. Not sure why negative x/y does not work
Hi 2 all once again. I decided to somehow modify nsDialogs original code situated over here. I've downloaded it, modified as i wanted and successfully compiled in MS VCExpress 2009 (125 Kb...isn't it too big?).
But here comes the problem: the heap doesn't allocate at all. Here it comes
Thus it fails with "access violation" error (0xC0000005) over here @ CreateControl (nsDialogs::CreateControl)
P.S.: I needed to add the ability to create "custom parented" controls, so that not only "g_dialog.hwDialog" could be the parent window when creating a control with CreateWindowEx function.
And if anybody can recompile the DLL for me I'll appreciate that greatly =) (I added one more "popint" to the code to get the necessary parent control).
But here comes the problem: the heap doesn't allocate at all. Here it comes
g_dialog.controls = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct nsControl)); And this HeapSize(GetProcessHeap(), 0, g_dialog.controls); returns me zero 🙁 . It continues even after HeapReAlloc!Thus it fails with "access violation" error (0xC0000005) over here @ CreateControl (nsDialogs::CreateControl)
...
if (!lstrcmpi(className, "BUTTON"))
g_dialog.controls[id].type = NSCTL_BUTTON; //over here
else if (!lstrcmpi(className, "EDIT"))
g_dialog.controls[id].type = NSCTL_EDIT;
... //and so on So can somebody say what's wrong?P.S.: I needed to add the ability to create "custom parented" controls, so that not only "g_dialog.hwDialog" could be the parent window when creating a control with CreateWindowEx function.
And if anybody can recompile the DLL for me I'll appreciate that greatly =) (I added one more "popint" to the code to get the necessary parent control).
Hello! I need help with a ListBox...
Is it possible to make funds nsDialogs, like that drawn in the image and is described below?
I make updater\installer...
To select updates. I use a listlist, but how to configure it, I do not know ..
I need like EmbeddedLists - ListView_MultiColumnCheckBoxes..
I need such features as:
- Columns with sorting
- Checks with disabling
- When you click on the component will show information about it.
- It would be the icons for the components, but it is not necessary.
Sorry for my bad English!
Is it possible to make funds nsDialogs, like that drawn in the image and is described below?
I make updater\installer...
To select updates. I use a listlist, but how to configure it, I do not know ..
I need like EmbeddedLists - ListView_MultiColumnCheckBoxes..
I need such features as:
- Columns with sorting
- Checks with disabling
- When you click on the component will show information about it.
- It would be the icons for the components, but it is not necessary.
Sorry for my bad English!
Kryder,
It's better to write a separate plugin especially for you 🙂 . But, it seems I got some workarounds for this.
It's better to write a separate plugin especially for you 🙂 . But, it seems I got some workarounds for this.
How do I do that on a white background, displayed correctly Label and Icon?
image:

there is my code:
image:

there is my code:
Function patcher
nsDialogs::Create 1018
Pop $0
GetFunctionAddress $0 OnBack
nsDialogs::OnBack $0
${NSD_CreateButton} 300 58 75 23 "$(Browse)"
Pop $BROWSE_BTN
GetFunctionAddress $0 Browse
nsDialogs::OnClick $BROWSE_BTN $0
${NSD_CreateCheckBox} 10 83 87 17 "Store path"
${NSD_CreateText} 9 59 285 20 "C:\Program Files\Rockstar Games\GTA San Andreas"
Pop $PATH
GetFunctionAddress $0 OnChange
nsDialogs::OnChange $PATH $0
${NSD_CreateLabel} 102 86 270 17 "Status: you select non-SA path, pleese select real path"
Pop $STATUS
${NSD_AddStyle} $STATUS ${SS_RIGHT}
${NSD_CreateIcon} 5 3 32 32 icon
Pop $ICON
${NSD_SetIconFromInstaller} $ICON $R1
${NSD_CreateLabel} 0 0 384 39 ""
Pop $R0
${NSD_AddStyle} $R0 ${WS_VISIBLE}|${SS_WHITERECT}|${WS_CHILD}|${WS_CLIPSIBLINGS}
${NSD_CreateLabel} 43 10 336 32 "${PRODUCT_NAME}"
Pop $TITLE
${NSD_AddStyle} $TITLE ${SS_CENTER}
CreateFont $1 "Lucida Console" "15"
SendMessage $TITLE ${WM_SETFONT} $1 1
${NSD_CreateGroupBox} 3 46 378 60 "SA Path"
${NSD_CreateGroupBox} 3 106 378 228 "Information"
CreateFont $FONT_BOLD "$(^Font)" "8" "800"
${NSD_CreateLabel} 12 122 360 16 "ОпиÑание:"
Pop $R0
SendMessage $R0 ${WM_SETFONT} $FONT_BOLD 1
${NSD_CreateText} 9 140 366 65 "$(ReadMe)"
Pop $README
${NSD_CreateLabel} 12 208 360 16 "ИнÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ Ð¿Ð¾ уÑтановке:"
Pop $R0
SendMessage $R0 ${WM_SETFONT} $FONT_BOLD 1
${NSD_CreateText} 9 227 366 65 "$(ReadMe)"
Pop $README
${NSD_CreateLabel} 12 299 168 33 "Patch by:$\nAuto-installer by:"
Pop $R0
${NSD_AddStyle} $R0 ${SS_RIGHT}
${NSD_CreateLabel} 183 299 190 33 "Deaglos (ICQ:76411326)$\nKryder (ICQ:9911684"
Pop $R0
SendMessage $R0 ${WM_SETFONT} $FONT_BOLD 1
${NSD_CreateHLine} 5 340 377 1 ButtonsLine
${NSD_CreateHLine} 5 39 377 1 LabelLine
${NSD_CreateButton} 3 347 75 23 $(Close)
Pop $CLOSE_BTN
GetFunctionAddress $0 CloseNSIS
nsDialogs::OnClick $CLOSE_BTN $0
${NSD_CreateButton} 306 347 75 23 Action
Pop $ACTION_BTN
Call GetSAPath
nsDialogs::Show
FunctionEnd Originally posted by bnicer
I have a problem with Quit here. Sorry to be disruptive again.Function OnClick
MessageBox MB_OK "Setup will now abort."
Quit
FunctionEnd
Originally posted by kichikI guess this one managed to disappear out of sight, after two years the issue is still open. I'd like to quit the installer after the users clicks a button. Is there a workaround I can use? Is there any chance this issue could be resolved in nsDialogs?
That's not currently possible as the code handling g_quit_flag is in the installer itself, separate from nsDialogs which doesn't have access to this flag. That wasn't a problem until the direct function callbacks were added. I need to think how it'd be best to handle this. Please submit a feature request.
How to delete strings from a listbox?
I didn't get any responses to this when posting on the main board. Maybe better luck here:
I've got a simple callback function when a button is clicked to remove the selected item from a listbox. It works correctly only if the topmost item is selected. Otherwise, it seems like the item directly above the actual selection gets removed from the LB. Here's the callback:
And here is the snippet of the dialog/page where it's potentially called:
I didn't get any responses to this when posting on the main board. Maybe better luck here:
I've got a simple callback function when a button is clicked to remove the selected item from a listbox. It works correctly only if the topmost item is selected. Otherwise, it seems like the item directly above the actual selection gets removed from the LB. Here's the callback:
Function Callback_RemoveSite
LogEx::Write " RemoveSite button clicked. Inside callback function."
${NSD_LB_GetSelection} $Listbox_SiteNameID $0 ${NSD_LB_DelString} $Listbox_SiteNameID $0
FunctionEnd And here is the snippet of the dialog/page where it's potentially called:
${NSD_CreateListBox} 0u 30u 150u 90u
Pop $Listbox_SiteNameID
${NSD_CreateButton} 172u 105u 58u 12u "--> Remove Site"
Pop $Button_RemoveSite
${NSD_OnClick} $Button_RemoveSite Callback_RemoveSite I'm not a GUI expert, but am I missing somthing here? If needed, I can attach the entire script.@chatterjb
Seems like nsDialogs bug. NSD_LB_DelString macro send the LB_DELETESTRING message with lParam set as the string of the item to delete, but according to MSDN lParam is not used by LB_DELETESTRING.
Instead NSD_LB_DelString macro should send the LB_DELETESTRING message with wParam set as the index of the item to delete.
Try using this code:
Seems like nsDialogs bug. NSD_LB_DelString macro send the LB_DELETESTRING message with lParam set as the string of the item to delete, but according to MSDN lParam is not used by LB_DELETESTRING.
Instead NSD_LB_DelString macro should send the LB_DELETESTRING message with wParam set as the index of the item to delete.
Try using this code:
PaRFunction Callback_RemoveSite
LogEx::Write " RemoveSite button clicked. Inside callback function."
SendMessage $Listbox_SiteNameID ${LB_GETCURSEL} 0 0 $0
SendMessage $Listbox_SiteNameID ${LB_DELETESTRING} $0 0
FunctionEnd
Originally posted by {_trueparuex^}Yup, this did the trick. Thanks for your help.
@chatterjb
Seems like nsDialogs bug. NSD_LB_DelString macro send the LB_DELETESTRING message with lParam set as the string of the item to delete, but according to MSDN lParam is not used by LB_DELETESTRING.
Instead NSD_LB_DelString macro should send the LB_DELETESTRING message with wParam set as the index of the item to delete.
Try using this code:PaRFunction Callback_RemoveSite
LogEx::Write " RemoveSite button clicked. Inside callback function."
SendMessage $Listbox_SiteNameID ${LB_GETCURSEL} 0 0 $0
SendMessage $Listbox_SiteNameID ${LB_DELETESTRING} $0 0
FunctionEnd
Just a minor bug report here as well (nsDialogs isn't listed in the bug tracker, unless I missed it)...
When using ${NSD_SetImage}, the image filename parameter cannot be stored in $R0 - this gets overwritten by nsDialogs and essentially just blanks the bitmap control you're trying to set an image to.
Work-around is to not use $R0.
Fix is to adjust nsDialogs.nsh:
When using ${NSD_SetImage}, the image filename parameter cannot be stored in $R0 - this gets overwritten by nsDialogs and essentially just blanks the bitmap control you're trying to set an image to.
Work-around is to not use $R0.
Fix is to adjust nsDialogs.nsh:
!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE
Push $0
Push $R0
Push $R1 ; NEW
StrCpy $R1 ${IMAGE} # in case ${IMAGE} is $R0 ; NEW
StrCpy $R0 ${CONTROL} # in case ${CONTROL} is $0
...
System::Call 'user32::LoadImage(i ${_LIHINSTSRC}, ts, i ${_IMGTYPE}, i0, i0, i${_LIFLAGS}) i.r0' "$R1" ; MODIFIED
...
Pop $R1 ; NEW
Pop $R0
Exch $0 has anyone been working on a treeview header for nsdialogs like the list view one
?
I can do all the treeview defines but I dont know the windows api to add items ect.
?
I can do all the treeview defines but I dont know the windows api to add items ect.
The win32 treeview does not have the same kind of header support like listview has, while it is possible (A header can exist as its own HWND inside any kind of parent control), you would need to write your own custom plugin...Originally Posted by ZmAn3 View Posthas anyone been working on a treeview header for nsdialogs like the list view one
?
I can do all the treeview defines but I dont know the windows api to add items ect.