What's the best way to do objects?
Nonsanity
form at nonsanity.com
Tue Mar 1 12:19:45 EST 2011
In LC, buttons and fields are objects with "methods" (functions and
commands) and "member variables" (custom properties) and so are groups. It's
possible to create an empty group under script control ("create group" "set
name of last group to myName") and set its behavior to a previously arranged
object, another empty group or something more easily accessible elsewhere.
This gets you invisible objects with common code and instance-specific data.
You could use hidden buttons or other objects just as well.
But really, except for when you really need "physical" objects like buttons
or cards, the OO paradigm isn't necessarily the best solution for all
problems. I've NEVER used this sort of behind-the-scenes OO code myself.
I'm happy to keep my collections of data in stack-based custom properties or
property sets, and keep the code to manipulate them in some central place -
usually the stack script. I can end up with huge stack scripts this way,
which I know bothers some people. They prefer to split the code up into
different locations, but I find dragging a scrollbar a faster way to get
from section to section than jumping to different single-use library stacks
or other cards, etc.
But to each their own... :)
~ Chris Innanen
~ Nonsanity
On Tue, Mar 1, 2011 at 4:51 AM, Gerry <gerry.orkin at gmail.com> wrote:
> Years ago I used to use Macromedia Director, and got to be pretty good at
> programming objects (the kind that operated independently once they were
> birthed...sort of OOP).
>
> What's the best way of doing that sort of thing in LiveCode?
>
> Cheers
>
> Gerry
>
>
>
> -- photo site: http://gerryorkin.com
>
>
>
> _______________________________________________
> 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
>
More information about the use-livecode
mailing list