What's in a group

Marielle Lange mlange at lexicall.org
Tue Feb 21 14:53:07 CST 2006


> Thanks to Ray for bringing this up
> and thanks to Mark for his perfectly succulent getprops example...
> 6 years later, and now I get it! how getprops works...
> who says you can't teach an old dog new tricks?

Hi Xavier,

Glad to see you are now taking a serious interest in getProp.

To answer the question on the difference between

getProp someProperty
and
function someFunction

This is obvious. The first let you manipulate a property, that is an  
attribute of an object (group, button, graphic, etc.) layed on the  
screen. Attributes refer to what the object look like, its appearance  
on the screen. The second let you run a function. A function is  
something that will transform some data. These data can be attributes  
of an object. For instance, you can convert radians into degrees or  
RGB colors into HSV. You can also manipulate information about the  
objects on the screen.

objects pGroup example, best is to use:
  function objects pGroup
   repeat with x = 1 to number of controls of pGroup
     put the name of control x of pGroup & return after myList
   end repeat
   sort myList
   return myList
  end objects

Personally, I only use getProp to go through a sequence of value  
assignment. Take the value if there is any provided. If there is none  
fetch a default value for the property if I have defined any, and  
utlimately, assign a default value of my own:

getProp gridColor
   put the gridColor of me into tValue
   if tValue is empty then put the defaults["gridColor"] of me into  
tValue
   if tValue is empty then put 127,164,198 into tValue
   return tValue
end gridColor

Checking that the value is a well formed color value take place  
somewhere else (in the "controller" part of the program) -- I got  
quite fond of the MVC approach, recently.


Playing around with getProp, setProp, I haven't found an answer to  
this yet. Is there a way to capture getProp, setProp calls?

I want to be able to write

                 set the dontexistyet of me to something

and get to know that I tried to set a property that doesn't exist  
yet. Try/catch doesn't capture this. I could of course check whether  
the property is within "the customProperties " of the object. But  
this requires a priori testing. I prefer to be notified after trying  
to use it. Any clue?

Best,
Marielle

------------------------------------------------------------------------ 
--------
Marielle Lange (PhD),  Psycholinguist

Alternative emails: mlange at blueyonder.co.uk,

Homepage                                                            
http://homepages.widged.com/mlange/
Easy access to lexical databases                    http:// 
lexicall.widged.com/
Supporting Education Technologists              http:// 
revolution.widged.com/wiki/



More information about the metacard mailing list