Indigo Rose Software

Go Back   Indigo Rose Software Forums > TrueUpdate 3.5 > TrueUpdate 3.5 Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2008
Olivier Chivet Olivier Chivet is offline
Forum Member
 
Join Date: Jul 2008
Posts: 3
Post DlgListBox.GetSelected return only the last selected item

Hi all,

First I'm new with TrueUpdate and LUA language.

I just downloaded the TrueUpdate 3.0 Trial version and try to use a ListBox in a dialog.
So I added a DlgListBox from the screen gallery in the wizard, changed the Style to "Checklist Box" and checked the "Multi select" option.
In the "On Next" action tab, I just want to display (for debug checking) the name of all selected items.

To do this, I added this code :
--------------------------------------
local Selected = DlgListBox.GetSelected(CTRL_LIST_BOX);
local index;
local value;

for index,value in Selected do
Dialog.Message( "Selection ", index..value, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
--------------------------------------
Even if I selected more than one Item, the GetSelected function always returned only the last item I selected.
Moreover, If I display the existing variable "nSelectedCount" (result of "DlgListBox.GetSelectedCount") it always display "1".

Could someone help me to obtain the complete list of selected items ?

Thanks a lot.

Olivier Chivet
Reply With Quote
  #2  
Old 07-21-2008
Ulrich's Avatar
Ulrich Ulrich is offline
Indigo Rose Staff Member
 
Join Date: Apr 2005
Location: Sao Paulo, Brazil
Posts: 823
Hello,

DlgListBox.GetSelected returns a table only if the ListBox is not set to Checklist Box. See this instead:

Code:
for i = 1, DlgListBox.GetCount(CTRL_LIST_BOX) do
    tProperties = DlgListBox.GetItemProperties(CTRL_LIST_BOX, i);
    if (tProperties.Checked) then
        Dialog.Message( "Selection ", i .."=" ..  tProperties.Text, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
end
Ulrich
Reply With Quote
  #3  
Old 07-22-2008
Olivier Chivet Olivier Chivet is offline
Forum Member
 
Join Date: Jul 2008
Posts: 3
Hello upeters,

Thank you for your code, It works fine.

And sorry for my misunderstanding between "(Get)Selected" and "Checked".

Quote:
DlgListBox.GetSelected returns a table only if the ListBox is not set to Checklist Box
It's not completly true. You can select more than one line in a ListBox with "Multi Select" option even if it has the "CheckList Box" style. Then the "GetSelected" function returns the correct list of item, checked or not.

Best regards.
Reply With Quote
Reply

Thread Tools
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking to see if a combo box has been selected. Barney Setup Factory 7.0 Discussion 2 06-19-2008 03:33 AM
Missed the Boat JerryQuinn AutoPlay Media Studio 6.0 9 11-23-2005 06:18 PM
ListBox.GetItemData from selected item lnd AutoPlay Media Studio 6.0 5 10-14-2005 01:32 PM
help with ftp connect CAI AutoPlay Media Studio 6.0 0 09-29-2005 08:13 PM
ListBox remove selected item? woter324 AutoPlay Media Studio 5.0 1 06-17-2005 06:03 AM


All times are GMT -6. The time now is 04:35 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software