Re: setProp and Lock messages

2011-12-05 Thread Pete
No I don't think you're missing anything - I am :-) I'm sure what you said is correct although I haven't tried it. The example in the manual regarding the use of lockMessages seems to relate to a setProp handler at the stack level to handle a custom property used by all cards in the stack. My po

Re: setProp and Lock messages

2011-12-05 Thread Richard Gaskin
Pete wrote: > On Sun, Dec 4, 2011 at 12:10 PM, Richard Gaskin wrote: >> >> Here's what the docs say with regard to recursion for setProp: >> >> Caution! If a setProp handler in one object's script sets the >> custom property for a different object, and the first object >> is in the second o

Re: setProp and Lock messages

2011-12-05 Thread Pete
Hi Richard, You're right the reference manual does say that. And on the very next page, it says: "If you use the set command within a setprop handler to set the custom property for the current object, no setProp trigger is sent to the target object. (This is to avoid runaway recursion, where the

Re: setProp and Lock messages

2011-12-04 Thread Richard Gaskin
Pete wrote: I think the reference to the documentation not being believable alluded to the LC documentation not the datagrid documentation. The LC Reference Manual and the dictionary are old and definitely contain inaccuracies. On the topic of setprop and recursion, for example, the reference

Re: setProp and Lock messages

2011-12-04 Thread Todd Geist
I agree, Pete On Sun, Dec 4, 2011 at 9:46 AM, Pete wrote: > > > Personally, I think this is another problem that affects new LC users. > It's a steep learning curve as it is and inaccurate docs make it steeper. > I'm probably old fashioned, but I still believe in the RTFM adage! > > Pete Ther

Re: setProp and Lock messages

2011-12-04 Thread Pete
I think the reference to the documentation not being believable alluded to the LC documentation not the datagrid documentation. The LC Reference Manual and the dictionary are old and definitely contain inaccuracies. On the topic of setprop and recursion, for example, the reference manual clearly

Re: setProp and Lock messages

2011-12-04 Thread Richard Gaskin
Todd Geist wrote: ... But I like all of these more than the alternative of using accessors on library stacks with name spaced accessors db_Contacts_getVersion // or db_getVersion("Contacts") Although this is a lot less typing, I just don't care for it. Maybe I am stupid... My apo

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
Thanks for this explanation. I think I get most of the issues now. I was looking for a dividing line between when to use them and when not to use them. Of course the line isn't clear, but now I think I understand what to watch out for. I like using setProp and getProp. It feels right to me. But

Re: setProp and Lock messages

2011-12-03 Thread zryip theSlug
On Sat, Dec 3, 2011 at 7:01 PM, Todd Geist wrote: Hi Todd, > More on this… > > I just tested locking messages prior to calling a handler that eventually > sets the dgData of a DataGrid.  Of course no data is set into the Datagrid. > > Is this not a problem? Using the lock messages command with

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
yeah I get it now. But I really prefer the property driven code syntax. Plus in my current experiments I am try to use buttons and behaviors to simulate code only Objects. //creates a new database object. just a button with a behavior. put defineDatabase( \ "Contacts", \

Re: setProp and Lock messages

2011-12-03 Thread Richard Gaskin
Using getProp and setProp seem like good choices initially, since they allow us to make what might appear to be reasonably simple, property-driven code. But - They are tricky, for many reasons. You've identified the most commonly-discussed issue: preventing recursion by locking messages. But t

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
Thanks Mark, I have also found that if you use send message to me in 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.schonewi...@economy-x-talk.com> wrote: > Hi Todd, > > I

Re: setProp and Lock messages

2011-12-03 Thread Mark Schonewille
Todd, I don't think this is a problem because you can unlock messages right before setting the data of the datagrid and lock them again immediately thereafter. unlock messages set the dgData of grp x to bla lock messages The only problem I foresee is that you have a handler that runs recursivel

Re: setProp and Lock messages

2011-12-03 Thread Mark Schonewille
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.

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
More on this… I just tested locking messages prior to calling a handler that eventually sets the dgData of a DataGrid. Of course no data is set into the Datagrid. Is this not a problem? Todd ___ use-livecode mailing list use-livecode@lists.runrev.com

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
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.schonewi...@economy-x-talk.com> wrote: > The example I gave you in my

Re: setProp and Lock messages

2011-12-03 Thread Mark Schonewille
Todd, You learn by trial and error and by asking other people. Of course, the documentation gives some clues but most of it is rather old. The example I gave you in my previous e-mail works. -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
umm… well that is just about the scariest thing I have every heard on this list. On Sat, Dec 3, 2011 at 8:42 AM, Mark Schonewille < m.schonewi...@economy-x-talk.com> wrote: > Hi Todd, > > Don't believe everything you read in the documentation. So exactly how are new people supposed to learn? T

Re: setProp and Lock messages

2011-12-03 Thread Mark Schonewille
Hi Todd, Don't believe everything you read in the documentation. -- 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 Sta

Re: setProp and Lock messages

2011-12-03 Thread Todd Geist
Hi Mark I see in the documentation and lessons that setProp and getProp handlers will fail if messages are locked Doesn't this present a problem if you are using Custom Props with setProp to store state for example. If somewhere in your code you lock messages and then try to store state, it will

Re: setProp and Lock messages

2011-12-03 Thread Mark Schonewille
Hi Todd, I don't quite understand your question. Surely, it is a good idea to use getProp and setProp handlers. You just need to make sure not to get trapped in a loop, but this applies to all messages. Sometimes, there is a danger that setting a property calls the setProp handler again, but lo

setProp and Lock messages

2011-12-03 Thread Todd Geist
Hello, I understand that SetProp and GetProp handlers are messages and if Lock messages is on then these will not work. But clearly people use GetProp and SetProp handlers. I see them used a lot in CustomControls. I assume the DataGrid uses them when you "set dgData of "…. So I am looking for cl