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

text-list/picked: extra internal behavior?

 [1/3] from: greggirwin::mindspring::com at: 26-Nov-2001 11:15


Hi All, Does anyone know what extra "thing" I need to do to make the following work? I have a text-list with a label (text face) above it. When the user clicks on the label, I add stars to all the items that are currently selected, using the technique from VID Notes. print mold lst/lines foreach item lst/picked [append item "*"] print mold lst/lines This works fine, and the print statements show that lst/lines is kept in sync with lst/picked, *if* the items have been selected by the user (i.e. with the mouse). If I programmatically set the picked values, like this: clear lst/picked ; I thought maybe alter didn't like using a block, but foreach fails as well. alter lst/picked probable-parts show actor ;foreach part probable-parts show actor [ ; alter lst/picked part ;] it doesn't work. lst/lines is not modified to stay in sync with lst/picked when they click on the label in this case. I looked at the view source for text-list, but the only thing that jumped out at me (as far as extra behavior a click would cause) was this: do :act slf f/text and I couldn't figure out where :act was to see what it was doing. Must be too early. :) Thanks for any suggestions or ideas. --Gregg

 [2/3] from: brett:codeconscious at: 27-Nov-2001 8:41


> If I programmatically set the picked values, like this: > > clear lst/picked > ; I thought maybe alter didn't like using a block, but foreach fails
as
> well. > alter lst/picked probable-parts show actor > ;foreach part probable-parts show actor [ > ; alter lst/picked part > ;]
Hi Gregg, I'm not quite sure what you are up to here. I gotta say too, I had never seen ALTER before, cool! Look at this comparison: a: "the" b: "quick" c: "fox" block-of-strings: reduce [a b c] clear b Now if clear the b string:
>>probe block-of-strings
== ["the" "" "fox"] So b refers to a string and so does the block, when you clear the string you see it get cleared for b and in the block. Picked in the text/list is exactly the same. It refers to one of the strings in your block of strings. Using alter I suspect is modifying the block in such a way that you are breaking the references that have been set up by VID. I have to rush off. Maybe others can be more clear. Brett.

 [3/3] from: greggirwin:mindspring at: 26-Nov-2001 17:24


Hi Brett, DOH! Thanks for the whack on the side of the head! I was looking right at the problem and trying to solve it in the wrong way. I'm working on copy'd strings (so I can restore them to their initial values when certain events occur) so I was referencing the wrong thing when I used 'alter. This is the solution: clear lst/picked foreach item items-to-highlight [ if find lst/lines item [ alter lst/picked first find lst/lines item ] ] or slightly condensed: foreach item items-to-highlight [ if found: find lst/lines item [alter lst/picked first found] ] << I'm not quite sure what you are up to here. >> I'm auto-highlighting items in text-lists, selecting defaults basically. In particular, our regional theatre group is holding auditions. Each hopeful, as they come up, will be matched against the parts defined for each show, by age (multiple fuzzy ranges allowed) and gender, and I highlight the parts they match. Then the judges can select, de-select, and add stars accordingly. Thanks again! --Gregg