Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign stacks in the root behaviors folder to the stackFiles of the app stack #154

Open
trevordevore opened this issue Jun 27, 2020 · 0 comments

Comments

@trevordevore
Copy link
Owner

When the LiveCode engine loads a stack file with a behavior property it immediately tries to resolve it. If it can't resolve it then the behavior silently fails to load and an app won't function as intended.

Example scenario where the behavior will not be associated with the stack:

  1. Stack A is a behavior script.
  2. Stack B has Stack A assigned to it as a behavior.
  3. You load Stack B into memory and Stack A is not assigned to the stackFiles property of Stack B (or any other stack already in memory).
  4. You load Stack A into memory.

When Stack B opens Stack A is not available and cannot be found by the engine. Thus the behavior assignment fails and your code doesn't work as expected.

Levure currently loads all behaviors into memory and then dispatches a LoadBehavior message to each one. Originally this allowed a script only stack to assign a parent behavior and to ensure that a parent behavior was in memory. Now that LiveCode supports with behavior when defining a script only stack it isn't necessary.

By assigning each behavior stack file to the stackFiles property of the app stack all behaviors will resolve properly when the engine first requests them. The LoadBehavior message can be removed and Levure can rely on engine features in order to provide a development experience that doesn't leave the developer scratching their head as to why something doesn't work because a behavior silently failed to load in the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant