Results 1 to 4 of 4

Thread: Selecting in listboxes

  1. #1
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781

    Selecting in listboxes

    I am having a strange issue that I canít figure out. I have my script that finds references to an item in the scene file and presents a listbox to the user with the items that are affected. I want to uses an event UDF to let the user select an item from the listbox. However I canít seem to get it to produce an array index that is valid.

    It seems to do so, and if I put an info() in the udf pointing to the array index it spits out the correct integer, but I canít for the life of me use that integer with the array of objectIDs that I have. I have checked that the object ID array is correct inside the event udf, and it is, and I Have a check so that it only tries to select the item if the Index from the listbox isnít nil.

    Any ideas?

  2. #2
    Member
    Join Date
    May 2006
    Location
    France
    Posts
    4,171
    No sure to follow you without your code,
    afaik the returned selection of ctllistbox is an array of selected indexes,

    a = getvalue(c1);

    for(i=1;i<=a.count();i++)
    {
    b = a[i];//get each selected index and use it for your need
    }



    Denis.

  3. #3
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    Can getvalue() be used on a listbox? I have used that for things like ctlpopup but I didn’t know that I could for a listbox. I will see if I can get that to work. If not, I will happily share my poorly commented amateurish code if you are willing to take a look.

  4. #4
    Registered User
    Join Date
    Sep 2015
    Location
    Sweden
    Posts
    781
    I got it to work, thanks!

    I think what was confusing me was that the listbox was spitting out an array of indexes. i would use the info() function to see what value it was spitting out, and it would show me an integer, that was the index of the selection. i wasn't selecting multiple items so didn't realize that i was looking at an array of indexes that was only one index large.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •