Basic Workflow
Create JsonLayouts
Class From Layout uses the Layout to Json utility (see setup instructions in the link).
The first step is to add the macro directive to your project:
#Macro: After Save, Sync Layouts, ide://run?File=%ADDITIONAL%\JsonLayouts.jar&Args=%PROJECT%&Args=%PROJECT_NAME%
Which creates and syncs the layout files with json files saved to a JsonLayouts directory in the project folder.
Alternatively, if you don't want it to run everytime you save the project you an add a Comment Link:
'Sync Layouts, ide://run?File=%ADDITIONAL%\JsonLayouts.jar&Args=%PROJECT%&Args=%PROJECT_NAME%
and run the sync manually by control clicking on the link.
Run ClassFromLayout
You can then run ClassFromLayout, click the open folder button and select the project directory or the JsonLayouts directory that was just created. You can also drag either onto the opening page.
Class From Layout also accepts a project folder or JsonLayouts folder as an argument, so if you package the app, you can call it from a comment link and pass the %PROJECT% alias.
'ClassFromLayout ide://run?file=Path\to\ClassFromLayout.exe&Args=%PROJECT%\JsonLayouts
The Path To Config Files field will be updated automatically and files will be saved there when you save a configuration.
The selection box will then show all of the Json Layout files that are in the directory. Select one and click the Open button.
You can then select a Class Type and generate some code to see what it does.
If you have previously saved a configuration for this layout you will see a popup with all the available configuration files that match the layout:
Create the class
Once you have generated a page of code, you will need to:
- Add the appropriate class and code module (as required) to your project,
- Copy the generated code into them.
If you use a code module for constants, make sure the name matches in your project and Class From Layout.