Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

text-list

 [1/2] from: gschwarz::netconnect::com::au at: 26-Sep-2002 14:50


I am having a problem in finding the position in the list, I want to know if it is the first, second... last, not the text of the picked line in the list. The below is just a quick test to help me find the answer, not the real use. The real use is reading a number of lines in a file and only the name of the line is shown in the list (eg. part type) so as to delete and add complete lines in the file. REBOL [] group1: layout [ account: text-list data sort load %. button "Account" [print account/picked ] button "Quit" 240.10.10 [quit] ] view group1 Regards, Greg Schwarz.

 [2/2] from: carl:cybercraft at: 26-Sep-2002 19:31


On 26-Sep-02, Greg Schwarz wrote:
> I am having a problem in finding the position in the list, I want to > know if it is the first, second... last, not the text of the picked
<<quoted lines omitted: 10>>
> ] > view group1
Hi Greg, You could use index? and find. ie, something like this... button "Account" [print index? find account/data account/picked] That would only work correctly if you were sure your list wouldn't contain duplicates though. You'd also have to take into account that you can pick more than one item in a list if Ctrl is used when clicking - picked will contain a block of strings then, not just a string. (For this reason I'd guess the index to the picked item isn't stored anywhere in text-list, but I may be wrong about that.) If you can have duplicates in the list, using same? to check if what's found matches what's picked might be one way to test it. (Find finds series that are equal, but they may not be the same series.) If they're not the same, then repeat the find from where the match was found until they do. HTH. -- Carl Read

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted