Working with grouped text

Ken Ray kray at sonsothunder.com
Tue Sep 23 17:35:01 EDT 2003


Sure, Dan. Here's a field script you can use:

on linkClicked pText
  put the currChoices of me into tChoices
  switch (pText)
    case "a test"
      if 1 is not among the items of tChoices then
        put 1 into item (the number of items of tChoices)+1 of tChoices
      end if
      break
    case "a quiz"
      if 2 is not among the items of tChoices then
        put 2 into item (the number of items of tChoices)+1 of tChoices
      end if
      break
    case "a puzzle"
      if 3 is not among the items of tChoices then
        put 3 into item (the number of items of tChoices)+1 of tChoices
      end if
      break
  end switch
  set the currChoices of me to tChoices
end linkClicked

It's a bit long-winded, but you get the idea...

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com 
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of 
> Dan Friedman
> Sent: Tuesday, September 23, 2003 4:01 PM
> To: RunRev Mail List
> Subject: Working with grouped text
> 
> 
> Ok... I could use a little help...
> 
> I have a field with grouped text such as:
> 
> This is [a test], [a quiz] or [a puzzle].
> 
> The text in "[]"s are grouped.  When the user clicks one of 
> the grouped phrases, I underline the group.  This is no problem:
> 
> if "link" is in the textStyle of the clickChunk then
>    if "underline" is in the textStyle of the clickChunk then
>        set the textStyle of the clickChunk to link
>    else
>        set the textStyle of the clickChunk to underline,link
>    end if
> end if
> 
> 
> My problem is when done, I want to examine the field and make 
> a list of what they underlined.  However, I want the list to 
> be numbers.  For example, if they click (that is underline) 
> "a test" and "a puzzle", then I want "1,3" (they underlined 
> the first and third set of grouped text).  If they only click 
> "a quiz", then I want "2" (they only selected the second set 
> of grouped text).
> 
> Anyone have any ideas?
> 
> 
> Thanks in advance!
> 
> -Dan
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 





More information about the use-livecode mailing list