Lists and Custom Properties

Kathy Jaqua kgjaqua1 at sbcglobal.net
Sat Apr 16 19:48:28 EDT 2005


Hi Gary:

Richard Gaskin rules:)

You can store a custom property in a Stack, Card or
Field Inspector and call it with a Mouse Handler:

put "The text I want to put in line" && uCustomProp &
"." into line # of field name of this card of this
stack

---------- Example 1------------------
I have done this in a popUp field.

As an example: You might want to store the number of
times the stack was opened.

In the stack inspector under "Basic Properties" scroll
down to "Custom Properties" click on the '+' sigh

Enter the property name uEnterThisStack = This is your
custom property for that stack

on preOpenStack:
if the owner of the target is me then
    get the uEnterThisStack of this stack -- get the
value of your custom prop
    put it into tCount
    add 1 to tCount
    set the uEnterthisstack of this stack to tCount
--adds 1 to your custom prop
  end if
(dont pass preOpenStack or you will get 2 added to
tCount:)
end preOpenStack
-------------------------------
 Now in the popUp field:
on mouseDown
    enterThisTemplate --handler used to display the
count in a popUp field
end mouseDown

on enterThisTemplate
 
    get the uEnterThisStack of this stack
    put it into tCount
   put "Number of Times Template was Opened" && tCount
&"." into line 1 of me

end enterThisTemplate

--------------Example 2-------------------------
For multiple lines: (line 1 the Time, line 2 the Date,
line 3 number of times stack is opened)

on mouseDown
-- since new text is placed in the field each time the
button is clicked
-- you need to clear out the old lines
  repeat with x = 1 to the number of lines in me
    delete line x of me
  end repeat
  ---- add your text--- 
  put "Time:" && the time into line 1 of me
  put "Today's Date:" && the long date &"."  into line
2 of me
  put "File:" && the short name of this stack into
line 3 of me
  enterThisTemplate --your handler calling your custom
prop: uEnterThis with your text
end mouseDown

on enterThisTemplate
  --if the owner of the target is me then
    get the uEnterThis of this stack
    put it into tCount
   put "Number of Times Template was Opened" && tCount
&"." into line 4 of me
  --end if
end enterThisTemplate

eMail an example and I will try to do it for you :-)

Kathy Graves Jaqua
A Wildest Dream Software
kgjaqua1 at sbcglobal.net






More information about the use-livecode mailing list