setProp and Lock messages

Todd Geist todd at geistinteractive.com
Sat Dec 3 13:24:12 EST 2011


Thanks Mark,

I have also found that if you use

send message to me in <someNumber> milliseconds


That lets the current execution chain end which set lock messages to False
before continuing

Todd


On Sat, Dec 3, 2011 at 10:14 AM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:

> Hi Todd,
>
> I understand your problem now. I think it is up to the programmer to be
> careful and accurate. The lock messages command exists exactly for
> preventing messages from being sent. You just have to make sure that you
> don't lock messages in a handler without unlocking them while you should.
> Sometimes you might want to lock messages before setting a property and
> sometimes you don't. It is your task do make the right decision and to
> remember and lock messages commands.
>
> Keep in mind that messages are locked until the originating handler
> finished running. The lock messages command doesn't persist forever, so
> this one thing less to worry about.
>
> If you have a really complicated handler, then there are ways to make sure
> that messages are not locked, for example
>
> repeat until not the lockMessages
>  unlock messages
> end repeat
>
> I hope this helps.
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Become our partner in sales http://qery.us/1bq Start selling Color
> Converter today. 20% commission!
>
> On 3 dec 2011, at 18:35, Todd Geist wrote:
>
> > Hi Mark
> >
> > Thank you for taking the time to respond. Perhaps I didn't ask the
> question
> > correctly, but as far as I can tell your example does address the
> question
> > I was asking.
> >
> >
> > On Sat, Dec 3, 2011 at 9:08 AM, Mark Schonewille <
> > m.schonewille at economy-x-talk.com> wrote:
> >
> >> The example I gave you in my previous e-mail works.
> >
> >
> >
> > Take a look at this example.
> >
> > On doSomething
> >
> >   lock messages
> >
> >   set the cProp of me to 3
> >
> > end doSomething
> >
> >
> >
> > setProp cProp x
> >
> >   lock messages
> >
> >
> >
> >   if x = "a" then
> >
> >      set cProp of the target to x
> >
> >   else if x = "b" then
> >
> >      set the cProp of the target to x
> >
> >   end if
> >
> >
> >
> > end cProp
> >
> >
> > I have written a setProp to only handle accept certain values, ("a" and
> "b"
> > ).  The DoSomething handler represents  "Some other code" that attempts
> to
> > set the property.  Since it has set locked messages, the setProp is
> ignored
> > and values other than a and b can be set.
> >
> > That is what I am talking about.
> >
> > This seems to me to be a pretty big problem.  How can I ever be sure that
> > setProp and GetProp handlers will actually be used.  I may not have
> control
> > over all the code and there might be a lock messages somewhere up the
> chain.
> >
> > Todd
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Todd Geist


(805) 419-9382



More information about the use-livecode mailing list