Can An Object Know About Itself?
bonnmike at gmail.com
Fri Mar 2 07:17:18 CST 2012
Another thought, use a frontscript.
As a test I created a group with several objects including 1 button to use
For the group, this:
if the long id of button "fscriptb" of me is not among the lines of the
insert script of button "fScriptb" of me into front
put the long id of me & random(1000)
For the button this:
on selectedobjectchanged pVar
set the oldSelected of this stack to the nowSelected of this stack
set the nowselected of this stack to the selectedobjects
put the oldselected of this stack
if the oldselected of this stack is not empty then dispatch
"rossiObjectDeselected" to (the oldselected of this stack)
It seems to work ok, though it doesn't take into account multiple instances
of the group, so perhaps another property to determine if the script has
been inserted into front already or not. Then use that property rather
than the contents of the frontscripts to decide whether or not to insert
the script into front.
On Fri, Mar 2, 2012 at 5:59 AM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:
> Make the group a background. That should allow it to catch the
> selectedObjectChanged message.
> Best regards,
> Mark Schonewille
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> Download the Installer Maker Plugin 1.7 for LiveCode here
> On 2 mrt 2012, at 07:48, Scott Rossi wrote:
> > Is there any way for an object to know when it is unselected using only
> > scripts within the object itself?
> > The selectedObjectChanged is sent to an object when it is selected, but
> > the object is deselected, the object will only get the
> > message if the selection is changed to nothing. Is there some way for
> > object to know it is no longer selected without resorting to an external
> > script? (no front, back, card or stack).
> > I have a group of objects that needs to reorganize itself when it is
> > deselected, but I'd like to avoid using external scripts to do this so
> > object is easily portable.
> > Thanks for any suggestions.
> > Regards,
> > Scott Rossi
> > Creative Director
> > Tactile Media, UX Design
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode