ksps1024
10th May 2011 21:39 UTC
Issues with ListBox
Hi,
I'm having issues with the listbox control. I have created a custom page with a listbox, and am populating it with strings read from a file(>1000 lines). The problem I'm experiencing is that while the items are being inserted into the listbox, I do not see them there until the process completes. Now the interesting part is that I can see the vertical scrollbar shrink. Once the file read is complete, then it displays the items in the listbox.....
Below is excerpt for the insertion of the strings.
${NSD_CreateListBox} 0 25 100% 80% " "
pop $listbox
SendMessage $listbox ${LB_INSERTSTRING} -1 "STR:Delete: $R0"
Any ideas how to get around this?
I'm trying to accomplish something similar to the install part where you can see the details of the installation.
Thanks in advance....
T.Slappy
11th May 2011 07:33 UTC
I do not see them there until the process completes
This is OK, because painting of the control is locked and whole control is repainted at the end.
Try to send WM_REDRAW message after each LB_INSERTSTRING - but you will lose a lot of performance!
ksps1024
11th May 2011 14:10 UTC
How is this done in the MUI_PAGE_INSTFILES where you can see the items being inserted in the details box (I assume WM_REDRAW is being sent??)
Afrow UK
11th May 2011 14:13 UTC
That uses a list view control and inserts items from another thread separate to the UI thread.
Stu
ksps1024
11th May 2011 14:28 UTC
Are there any examples out there that mimic the INSTFILES page? If not can you point me in the right direction with the listview?
Thanks
Afrow UK
11th May 2011 17:16 UTC
Search Google for "nsis listview".
Stu
vicokoby
11th June 2011 00:03 UTC
ListBox Multiselectable
Please teachme how to get the selected strings in a ListBox with the style ${LBS_MULTIPLESEL}
${NSD_LB_GetSelection} return only a item, I want recover several items.
Please helpme!
Afrow UK
12th June 2011 16:42 UTC
These are the messages you can send: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
Stu
vicokoby
16th June 2011 18:32 UTC
Please helpme with this issue,
This is a try to get the selected items
!macro Show_Selected_Items ListBox_HWND
StrCpy $0 ${ListBox_HWND} ; $0 = ListBox handle
System::Alloc 1024
Pop $1
StrCpy $2 $1 ; $2 = buffer to store the selected items.
System::Call 'user32::SendMessage(i, i, i, i) i(r0, ${LB_GETSELITEMS}, 100, r2) .r3' ; $3 = Number of selected items; (Max capacity: 100)
StrCpy $4 0 ; $4 = Counter
Next:
IntCmp $4 $3 Done ShowItem Done
ShowItem:
; Here is my problem
; My problem is that not you how to pass the elements from the buffer to the message
; The enclosed Code line is incorrect please helps me to fix it
; That line returns any element of the listbox, not the selected items.
;-------------------------------------------------------------------------------
System::Call 'user32::SendMessage(i, i, i, t) i(r0, ${LB_GETTEXT}, r4, .s) .r6'
;-------------------------------------------------------------------------------
Pop $5 ; $5 = Selected Item (It is what wanted)
MessageBox MB_YESNO "Selected Item: $5 Size: $6$\n$\nDo you want to continue?" IDNO Done
IntOp $4 $4 + 1
Goto Next
Done:
System::Free $1
!macroend
Anders
16th June 2011 21:16 UTC
Your LB_GETTEXT code is ok, but you need to get the item index out of the array you filled with LB_GETSELITEMS
Quote:
vicokoby
17th June 2011 15:36 UTC
Thank you very much!
!macro Show_Selected_Items ListBox_HWND
StrCpy $0 ${ListBox_HWND} ; $0 = ListBox handle
System::Alloc 1024 ; max items would be 1024/4, not 100...
Pop $2
System::Call 'user32::SendMessage(i, i, i, i) i(r0, ${LB_GETSELITEMS}, 100, r2) .r3'
StrCpy $4 0 ; $4 = Counter
Next:
IntCmp $4 $3 Done ShowItem Done
ShowItem:
IntOp $5 $4 * 4
IntOp $5 $5 + $2
System::Call '*$5(i.r5)'
System::Call 'user32::SendMessage(i, i, i, t) i(r0, ${LB_GETTEXT}, r5, .r5) .r6'
MessageBox MB_YESNO "Selected Item: $5 Size: $6$\n$\nDo you want to continue?" IDNO Done
IntOp $4 $4 + 1
Goto Next
Done:
System::Free $2
!macroend |