Old 11th March 2004, 23:32   #1
chief2004
Junior Member
 
Join Date: Mar 2004
Posts: 2
Question Dynamically updating a listbox

I have a listbox containing a dynamically generated list of items.

What I want to do is to delete a specific item in the list when a button is clicked. I have detected the button click and I can change text in textboxes using:

GetDlgItem $1 $hwnd 1201 ; field 2 (1200 + field 2 - 1)
SendMessage $1 ${WM_SETTEXT} 0 'STR:TextBoxUpdated'
abort

But this same method does not work for list boxes.
Any suggestions?
chief2004 is offline   Reply With Quote
Old 12th March 2004, 02:08   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Use the message "LB_DELETESTRING" (To delete a string inside a ListBox) with "LB_FINDSTRINGEXACT" (To find the string inside a ListBox):

PHP Code:
!define LB_DELETESTRING 0x0182
!define LB_FINDSTRINGEXACT 0x01A2

#$R0 = Control Handle
#$R1 = String to Delete

System::Call "user32::SendMessageA(i R0, i ${LB_FINDSTRINGEXACT}, i '1', t R1) i.R1"
System::Call "user32::SendMessageA(i R0, i ${LB_DELETESTRING}, i R1, n) i"

StrCmp $R1 -1 0 +2
  MessageBox MB_OK 
"Error: String not found." 

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 12th March 2004, 03:55   #3
chief2004
Junior Member
 
Join Date: Mar 2004
Posts: 2
Sweet - it worked like a charm - thanks
chief2004 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