Inheritance in Revolution?

Arthur Urban aturban at qwest.net
Fri Sep 10 01:04:05 EDT 2004


> > What I'm looking for is something in the Property Inspector 
> that would
> > allow
> > me to specify an object as the script provider for another object.
> > References like target and me would still operate as if the actual 
> > control
> > were used, but it would be as if you had typed the same script into 
> > fifty
> > buttons manually. Change the code in the master control, 
> and all the 
> > others
> > immediately have access to the changes.
> >
> > Unless this ability already exists, in which case, carry on...
> 
> Select your 50 buttons (or whatever objects you want to inherit the 
> script) and group them. Now put your script in the group's 
> script, not 
> in each buttons. If you click in one of the buttons, but there is no 
> "on mouseUp" in the button script, the message will pass to the 
> button's container, in this case the group, and can be handled there. 
> If you want all the objects on your card to call the same 
> handlers, you 
> can put the handler in the card script.

I probably wasn't as clear as I could have been. These 50 buttons all live
on different cards, different sub-stacks, etc. Think of this ability as one
might approach a Password Field. You'd write the clever text hiding code in
the field's script, and then maybe use this field in two or three different
locations. When you discover that bug, you just change the master script,
and no matter where the other buttons happen to be, they gain the benefit of
the fix without extra copy/paste efforts.

This is probably too cool a feature to ever actually see, but I can hope.
What do the Rev Developers think? Wouldn't this add a tremendous level of
code (and object) reusability, not to mention data/code encapsulation?

~~~ Arthur

"Never interrupt your enemy while he is making a mistake."



More information about the use-livecode mailing list