Looking for tips on memory mgt in standalones

J. Landman Gay jacque at hyperactivesw.com
Fri Dec 7 00:36:50 EST 2012


On 12/6/12 9:31 PM, tbodine wrote:

> If this editor is to support multiple documents open at once, then there's
> the matter of knowing which is the active one at a given moment. I saw in
> the Dictionary some command that tells which stack the mouse is over. Is
> there something similar for keyboard focus?

If the user is typing into it, it's usually the defaultstack unless a 
script has changed that. It's also probably the topstack.

>
> What would be ideal is an event triggered in LC when the user clicks a
> different window activating another "document" stack. (In Director's Lingo
> language, there's activateWindow and deactivateWindow event handlers.
> Anything similar in LC?)

As Monte said, suspendstack and resumestack messages are sent.

>
> I expect these "documents" will all have similarly named custom properties,
> so it could get messy keeping track of them with many files open. I'm
> thinking that when a particular "document" is active, then its custom props
> are copied to a global that would be used by the editor's code. And when
> that "document" is deactivated, code would write the global back out to that
> file's custom property. Then the newly selected "documents" custom props
> would be loaded into the global.
>
> Do you foresee pitfalls with this? Is there a better way?

Why not just read and write properties directly to/from the document 
stack itself?

On openstack or resumestack you could keep track of the stack name if 
you want to be sure which one you're dealing with, and always refer to 
it in scripts by name instead of just using "the defaultstack".

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list