gcanyon / navigator

The amazing small powerful plugin for Livecode that makes you a better, faster developer.
12 stars 4 forks source link

Option to SOS a script but ignore existing behaviors #5

Open macMikey opened 6 years ago

macMikey commented 6 years ago

In the case of objects created with tmControls, there is already a behavior chain set for the tmc objects. Typically there is a button script that is set as the behavior of the group, and then that button has another button as the "master behavior".

For example, for a tmc "button", which is really a group of objects, there is a script for the group, then a behavior that is used for all tmc buttons, and then a tmc master behavior.

The more I've been thinking about this, the more I think that maybe it would be better to leave the object behavior chain alone, and simply SOS the script of the object, which will leave the entire project cleaner. Breaking all these chained behaviors out shouldn't break anything, but we will wind up with extra SOS's when we probably have no intention of ever editing any of it.

gcanyon commented 6 years ago

That's exactly what Navigator does. If you select a button that has a script and a behavior, and select Convert to Behaviors, the dialog will display with just that button in the list. If you convert then:

  1. The button's script will be moved to a SoS.
  2. The button's behavior will be changed to the SoS.
  3. The SoS's behavior will be set to the original behavior for the button.
  4. The log will include a section labeled something like "Script-only Stack Behavior Code" and that will include a line that is something like:

set the behavior of to <the id of the (former) behavior of the button>

In order to retain the original order of things, you'd have to include that line of code in your startup scripts, since SoS don't (yet) support storing their own behaviors.

IF, on the other hand, you wanted to convert everything to SoS behaviors, then after opening the Convert to Behaviors dialog you would click the button "Add Behavior Chains" and the list of controls to convert would expand from just the original button to whatever the chain of behaviors is for that button. Then converting would convert the button and all the behaviors.

So just don't click that button, and you get exactly what you describe above.

gc

On Sun, Feb 18, 2018 at 7:37 PM, macMikey notifications@github.com wrote:

In the case of objects created with tmControls, there is already a behavior chain set for the tmc objects. Typically there is a button script that is set as the behavior of the group, and then that button has another button as the "master behavior".

For example, for a tmc "button", which is really a group of objects, there is a script for the group, then a behavior that is used for all tmc buttons, and then a tmc master behavior.

The more I've been thinking about this, the more I think that maybe it would be better to leave the object behavior chain alone, and simply SOS the script of the object, which will leave the entire project cleaner. Breaking all these chained behaviors out shouldn't break anything, but we will wind up with extra SOS's when we probably have no intention of ever editing any of it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gcanyon/navigator/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmz0Q5hp7D4UfC4gBtZTBM7IpIzPH2Zks5tWOx1gaJpZM4SKA02 .

macMikey commented 6 years ago

Hmmm. I didn't get that from reading the documentation the first couple times. I read it again this morning and I get it now. It might be good to have that behavior be more explicit (and then close this issue).

gcanyon commented 6 years ago

The documentation is behind the reality, especially since I created the convert dialog after the docs. I'll update and then close this.