Is it a big thing to think that behaviors might not be limited to buttons? Why not have any object, including stacks, be the repository of a behavior script?
Craig Newman
Wide open behaviors
Moderator: Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Wide open behaviors
I argued for that back when the implementation was still in early beta. As adamant as I was initially I've come to be okay with the implementation as it is, since it really doesn't matter what sort of object holds the script: none of its own properties come into play, since using "me" refers to the instance and not the behavior.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Wide open behaviors
Hi,
I believe it would have been more elegant if RunRev had created a special, new object to store parent scripts in. They might have called it a class object, to lure OOP advocates.
Mark
I believe it would have been more elegant if RunRev had created a special, new object to store parent scripts in. They might have called it a class object, to lure OOP advocates.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Wide open behaviors
Agreed. Such things would also make great virtual objects we could use with behaviors to implement more OOP-like architectures.Mark wrote:I believe it would have been more elegant if RunRev had created a special, new object to store parent scripts in. They might have called it a class object, to lure OOP advocates.
Hopefully somewhere down the road....
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Wide open behaviors
I agree. I think that it would be a good thing to have a non-UI object hosting the behavior. Moreover, it would be useful if these could be created dynamically from a prototype --as it is now, but once created the new instance would hold its own runtime state that is privately, protected or globally accessible to the application (e.g., no path to a physical object on a stack). Ideally, these objects could contain behaviors from multiple prototypes. Finally, you could make these objects persistent --or contain hooks to become persistent.
This does not require changing the current Behavior. I still like the current approach, because a behavior is nicely encapsulated. Plus the fact that it lives in a button it can contain unit tests in its mouseUp event and can be copy-and-pasted anywhere!
/Carl
This does not require changing the current Behavior. I still like the current approach, because a behavior is nicely encapsulated. Plus the fact that it lives in a button it can contain unit tests in its mouseUp event and can be copy-and-pasted anywhere!
/Carl
-
- Posts: 36
- Joined: Fri Jan 01, 2010 12:11 am
Re: Wide open behaviors
If any of you have seen the Toolbook product, this is what they call "shared scripts". And they are kept someplace in the stack not in a UI element. The really nice thing is there is a built-in user interface to select the shared script from the repository of shared scripts. No finding your button, and then typing in the name, misspelling it as you go... But keeping the script in a button is not too bad, but the language has commands to create and delete shared scripts as well. Actually, I think the Rev way is more flexible, but more work too because there is no behavior "picker".