Development with Code Generation: Difference between revisions
Jump to navigation
Jump to search
Line 34: | Line 34: | ||
** eg. <code>actClose: {Label=&Close, ActionId=eClose, Tooltip=Closes this window, Image=Close.ico}</code> | ** eg. <code>actClose: {Label=&Close, ActionId=eClose, Tooltip=Closes this window, Image=Close.ico}</code> | ||
** eg. <code>actMainMenu: {Label=Petra &Main Menu, ActionClick=FTheObject.OpenMainScreen}</code> | ** eg. <code>actMainMenu: {Label=Petra &Main Menu, ActionClick=FTheObject.OpenMainScreen}</code> | ||
** '''Enabled''': Actions can depend on other actions or conditions; they will be disabled if the condition is false; eg <code>Enabled: cndSelectedSupplier</code>; this can be set in a grid, with '''SelectedRowActivates'''; eg <code>grdSupplierResult: {Dock=Fill, ActionDoubleClick=actSupplierTransactions, SelectedRowActivates=cndSelectedSupplier}</code> | |||
* '''Controls''': see [[Screen scaffolding: controls]] | * '''Controls''': see [[Screen scaffolding: controls]] | ||
* '''Menu''': TODO | * '''Menu''': TODO | ||
* '''Toolbar''': TODO | * '''Toolbar''': TODO | ||
* '''Layout''': TODO | * '''Layout''': TODO |
Revision as of 11:57, 14 July 2009
Tools
- In csharp/ICT/PetraTools
- uses CSParser to parse existing C# files
- write code:
- can comment generated code
- can insert regions with name ManualCode (need endregion ManualCode as well)
- TODO: write into Templates
- Plugin writers for different output (Winforms, GTK, ASP.net)
YML
- general definition: YML is shorter and easier to write and read than XML, but you can get the same structure than XML. This is achieved for example by not having opening and closing tags, but by using identation to define the hierarchy of elements.
- specification: http://yaml.org/spec/1.2/
- see a parser for YAML: http://yaml-net-parser.sourceforge.net/default.html
- we have our own converter from yaml to xml: project Ict.Tools.CodeGeneration, Yml2Xml.cs, Ict.Tools.CodeGeneration.Yml2Xml
- advantage: we can write short yaml code, but can use the comfort of the XML parser in .net to walk through the hierarchy
- yml2xml maps the YAML into XML
XAML
- TODO: XAML idea
Documentation YML for OpenPetra Forms
- generally the yml files inherit from each other (BaseYaml)
- this allows us to only define the default menu items once, in PetraForm.yaml, and they will be included in all derived forms
- FormType:
- abstract: if this is just used as a base form for other real forms
- navigation: the main window, the module windows
- edit: edit screens
- crud: CRUD screens (Create, Read, Update, Delete)
- find, browse: find screens
- MainEditTable: if this is set, you will need to write less DataField attributes for the controls. The name of the controls will be matched to a field in the given table; if such a table field exists, it will be linked to the control.
- Events: here you can link form events to methods in your code
- eg.
Activated: {class=System.EventHandler,method=FTheObject.TFrmPetra_Activated}
- eg.
- Actions: actions can be used by menuitems, toolbarbuttons, and other controls; this is useful to be able to enable/disable an action on the whole screen, and to only define a certain action once, and refer to it from all controls that trigger the same action
- eg.
actClose: {Label=&Close, ActionId=eClose, Tooltip=Closes this window, Image=Close.ico}
- eg.
actMainMenu: {Label=Petra &Main Menu, ActionClick=FTheObject.OpenMainScreen}
- Enabled: Actions can depend on other actions or conditions; they will be disabled if the condition is false; eg
Enabled: cndSelectedSupplier
; this can be set in a grid, with SelectedRowActivates; eggrdSupplierResult: {Dock=Fill, ActionDoubleClick=actSupplierTransactions, SelectedRowActivates=cndSelectedSupplier}
- eg.
- Controls: see Screen scaffolding: controls
- Menu: TODO
- Toolbar: TODO
- Layout: TODO