Works sometimes -- but not other times

Mark Rauterkus mark.rauterkus at gmail.com
Thu Jun 21 19:45:39 EDT 2012


Hi Pros,

I have a sub stack that has 1 card with a FIND field that user types
in a name. As one types in the names of the students, the results
shrink to the results of those in the class using a custom field
property so that one person, (Firstname Lastname) appears.

Then when the results are ONE person, I want to show a photo of that
person. For now, 3 beeps is enough.

I must not be using the right handler. Now deploying, poorly, the "on
Idle" handler.

So, when I first go to the stack, it does not work. But, after going
to the script of the field "Filtered_Results", and I don't change
anything except push the green arrow key, it runs. And then thereafter
it runs without any problems. Upon arrival the first time, the fancy
script does not work.

Here are the scripts.

Filed "Filtered_Results"

on idle tUsermame
   -- to avoid a loop with an idle:
   if the cFlagPhotoGet of field "Type_Name_to_Find" of stack
"QuickieFinder" is "true"

   then
      Get the number of words of me
      if it is two then
         beep 3
         -- More goes here to set the photo

         set the cFlagPhotoGet of field "Type_Name_to_Find" of stack
"QuickieFinder" to ""
      end if
   end if
end idle


- - - -


Script for Field "Type_Name_to_Find"
on keyDown var, temp, pKey

   -- MR: This avoids a loop on the other field with an on idle script.
   set the cFlagPhotoGet of field "Type_Name_to_Find" of stack
"QuickieFinder" to true

   -- MR: below works fine:
   get the cNewmanResults of stack "Kids"
   put it into temp
   put var after me
   filter temp with "*" & me & "*"
   put temp into fld "Filtered_Results"

   -- MR: After a backspace to nothing, clear the other field.
   if pKey is a number then
      pass keyDown
      send "exitField" to field "Type_Name_to_Find"
   end if

end keyDown

on exitField -- remove visual signs that the field is being edited
   put "" into field "Filtered_Results"
   put "" into field "Type_Name_to_Find"
end exitField


- - -
I'm not doing well at using the backspace key as well. I'd like to get
rid off all the content in the results field if the backspace key
takes the field to empty.



--
Ta.


Mark Rauterkus       Mark.Rauterkus at gmail.com
PPS Summer Dreamers' Swim and Water Polo Camp Head Coach with
Neighborhood Learning Alliance

http://NeighborhoodLearning.org




More information about the use-livecode mailing list