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

Installer add another layer of behavior script #3

Open
macMikey opened this issue Jan 24, 2019 · 6 comments
Open

Installer add another layer of behavior script #3

macMikey opened this issue Jan 24, 2019 · 6 comments

Comments

@macMikey
Copy link
Contributor

I think the installer for the fb should add one additional behavior layer above the fb, for storing the developer's code that is specific to a project. Example: I am adding context menu handlers, keyboard events, a double-click handler, etc., but none of that should be foisted on the developer in every fb, so it should probably be up a level from the fb (it could be in a script for the fb group, but this is Levure, so it should be in a behavior SOS).
The question I am wrestling with is placement of said SOS. When the installer runs it could prompt, or have a dialog, or for the git-it-done version I'm thinking of just throwing it into /ui//behaviors. Thoughts?

@trevordevore
Copy link
Owner

@macMikey I agree about needing to create the behavior that the developer can put their own scripts in. We definitely don't want the developer editing any behaviors that come with the helper.

I think the DataView helper should come with a command that creates the DataView, creates a behavior if the developer desires, and then returns a reference to the newly created control. Any helper that builds on the DataView can then call this command and then customize the newly created DataView group control as needed. For example, the File Browser could perform the following steps when calling createNewFileBrowserDataView:

  1. Create DataView using command in DataView IDE library. One of the parameters is the behavior to use. In the case of the File Browser pass in the long id of stack "File Browser DataView Tree Behavior".
  2. Set additional properties on the control that is created.

As for where to the put the behavior, I can think of a few possibilities.

  1. Nowhere as the developer wants to script the DataView group control itself. There is no need for a behavior in this case.
  2. An invisible button that is added to the same card as the DataView control is being added to.
  3. A script in a "behaviors" folder that sits alongside the stack file that the DataView control is being added to.

My thoughts on implementation:

  • User should be prompted for the name of the behavior.
  • I don't think [2] is necessary (at least at first).
  • If they user wants to create a behavior then automatically put it in a /behaviors folder sitting alongside the stack file that DataView control is being added to.

So maybe there are three prompts?

  1. What would you like to name the new control?
  2. Would you like to attach a behavior to the new control where you can add your application specific code such as a selectedRowChanged handler?
  3. What would you like to name the behavior script? (If we could provide some default value based on stack/card/control name.)

One last thought - the handler that prompts the user for options should be separate from the handler that creates the DataView. This allows the developer to automate creation of DataViews by just passing in parameters. It also allows for an IDE component to be created which could make a call to the handler that creates the DataView.

@trevordevore
Copy link
Owner

@macMikey I mocked up an example of in the dataview repo. Take a look at this commit on the tkd-ide-library branch:

trevordevore/levurehelper-dataview@23a11c9

This has been lightly tested.

@macMikey
Copy link
Contributor Author

Hopefully this weekend I'll get a chance to look at it.

@trevordevore
Copy link
Owner

@macMikey I made some more progress on commands that automatically create DataViews and DataView Trees. Take a look at the following branches in each repo:

https://github.com/trevordevore/levurehelper-dataview/tree/tkd-ide-library
https://github.com/trevordevore/levurehelper-dataview_tree/tree/tkd-ide-library

You will find an ide folder in each branch which has a library and templates. The DataView repo has a create dialog and all of the logic. The DataView Tree repo shows how to customize the DataView library commands and use your own row templates, etc. See dvtIdecreateDataViewTreeControlUsingDialog in ide/ide_library.livecodescript. You could base a File Browser creation handler off of that code.

@macMikey
Copy link
Contributor Author

we definitely need to build a real installer for levure add-ons.

@trevordevore
Copy link
Owner

I think it could be built into the Bakers Assistant:

Repo: https://github.com/trevordevore/bakers-assistant
Blog: https://www.bluemangolearning.com/livecode/2019/02/the-bakers-assistant-ide-plugin/

Although there is no UI for it yet, there is some code in the repo that downloads the ./database/helpers.json file. A file like that (or a YAML or some other format) could be used to store a database of helpers.

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

2 participants