Open macMikey opened 5 years ago
@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:
So maybe there are three prompts?
1) What would you like to name the new control?
1) Would you like to attach a behavior to the new control where you can add your application specific code such as a selectedRowChanged
handler?
2) 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.
@macMikey I mocked up an example of in the dataview repo. Take a look at this commit on the tkd-ide-library
branch:
This has been lightly tested.
Hopefully this weekend I'll get a chance to look at it.
@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.
we definitely need to build a real installer for levure add-ons.
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.
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?