Old 10th May 2011, 20:39   #1
ksps1024
Junior Member
 
Join Date: May 2011
Posts: 5
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.
code:


${NSD_CreateListBox} 0 25 100% 80% " "
pop $listbox

SendMessage $listbox ${LB_INSERTSTRING} -1 "STRelete: $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....
ksps1024 is offline   Reply With Quote
Old 11th May 2011, 06:33   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 562
Send a message via ICQ to T.Slappy
Quote:
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!

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2022: www.visual-installer.com
or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 11th May 2011, 13:10   #3
ksps1024
Junior Member
 
Join Date: May 2011
Posts: 5
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??)
ksps1024 is offline   Reply With Quote
Old 11th May 2011, 13:13   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That uses a list view control and inserts items from another thread separate to the UI thread.

Stu
Afrow UK is offline   Reply With Quote
Old 11th May 2011, 13:28   #5
ksps1024
Junior Member
 
Join Date: May 2011
Posts: 5
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
ksps1024 is offline   Reply With Quote
Old 11th May 2011, 16:16   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Search Google for "nsis listview".

Stu
Afrow UK is offline   Reply With Quote
Old 10th June 2011, 23:03   #7
vicokoby
Junior Member
 
Join Date: Jun 2011
Posts: 15
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!

Last edited by vicokoby; 10th June 2011 at 23:05. Reason: Missing details
vicokoby is offline   Reply With Quote
Old 12th June 2011, 15:42   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
These are the messages you can send: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

Stu
Afrow UK is offline   Reply With Quote
Old 16th June 2011, 17:32   #9
vicokoby
Junior Member
 
Join Date: Jun 2011
Posts: 15
Question

Please helpme with this issue,

This is a try to get the selected items
Quote:
!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


Example complete: ListBoxMultipleSel.nsi


Please give me more help!
vicokoby is offline   Reply With Quote
Old 16th June 2011, 20:16   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Your LB_GETTEXT code is ok, but you need to get the item index out of the array you filled with LB_GETSELITEMS

Quote:
!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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th June 2011, 14:36   #11
vicokoby
Junior Member
 
Join Date: Jun 2011
Posts: 15
Thank you very much!
vicokoby is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump