Set the imagesource of a character to a built in graphic

Bob Sneidar bobsneidar at iotecdigital.com
Mon Jun 26 13:18:58 EDT 2017


Richard, that is kind of what I was seeing with replace in field. Very dicey. So I decided to see if I could use the hidden propery method to work. Here is what I came up with. Remember that char 1 of the 1st level lines are spaces, and the 1st char spaces in those lines have the imageData set to a + graphic so clicking on the + will expand and collapse the line. The second level lines do not start with spaces, so I can use that to discriminate between first level lines and others (I supose I could have checked for the imageData but what the hell):

on mouseUp
   put the clickChar into tChar
   if tChar is not space then exit mouseUp
   put word 2 of the clickLine into tLine -- the line number of the line clicked
   put the text of me into tText
   put tLine +1 into tStartLine

   repeat with i = tStartLine to the number of lines of tText
      if char 1 of line i of tText is space then
         exit repeat
      end if

      put i into tEndLine
   end repeat
   
   if char 1 of line tEndLine of me is space then exit mouseUp -- there are no sub-lines

   if the hidden of line tStartLine to tEndLine of me is true then
      set the hidden of line tStartLine to tEndLine of me to false
   else
      set the hidden of line tStartLine to tEndLine of me to true
   end if
end mouseUp

Bob S






More information about the use-livecode mailing list