Programmer Guide/Macro Library/CTemplates: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}} - Template Management}} | ||
:'''File''': Classes.STX, linked to library STX.LIB | |||
:'''Parent class''': [[Programmer Guide/Macro Library/COBJ|CObj]] | |||
A class to manage | A class to manage templates (e.g. of type '''DialogTemplate''', '''ASegTemplate''' or '''attrTemplate''') | ||
==Create Instance== | |||
;Usage: | |||
:<code>ctemplates [ <var>typetag</var> ]</code> | |||
:<code>cobj new ctemplates [ <var>typetag</var> ]</code> | |||
:;<var>typetag</var>selects the type of templates to be managed (default: '''ASegTemplate''') | |||
;Result: an initialized instance | |||
==== | ==Delete Instance== | ||
;Usage: <code><var>instance</var> destroy</code> | |||
;Result: none (void) | |||
==GetTable== | |||
;Usage: <code><var>instance</var> gettable</code> | |||
;Result: an extended table containing the id's of the available templates of the selected type (one per entry, field '''id''') | |||
==== | ==GetList== | ||
;Usage: <code><var>instance</var> getlist</code> | |||
;Result: an semi-colon separated list of the id's of the available templates of the selected type | |||
==GetAttributeList== | |||
;Usage: <code><var>instance</var> getattributelist <var>id</var></code> | |||
:;<var>id</var>: the id of the template | |||
;Result: an blank separated list of attributes defined in the selected template | |||
== | ==GetValueListForAttribute== | ||
;Usage: <code><var>instance</var> getvaluelistforattribute <var>type ; id ; attr</var></code> | |||
:;<var>type</var>: selects type of result | |||
::'''table''': return a simple table containing on value per line; the default value is stored in the first line | |||
::'''list''': return a blank separated list of values | |||
:;<var>id</var>: the id of the template | |||
:;<var>attr</var>: the name of the attribute | |||
;Result: an blank separated list of defined values or a simple table containing one value per line (see argument <var>type</var>) | |||
==GetDefaultValueForAttribute== | |||
;Usage: <code><var>instance</var> getdefaultvalueforattribute <var>id ; attr</var></code> | |||
:;<var>id</var>: the id of the template | |||
:;<var>attr</var>: the name of the attribute | |||
;Result: the default value | |||
==== | ==GetFlags== | ||
;Usage: <code><var>instance</var> getflags <var>id ; attr</var></code> | |||
:;<var>id</var>: the id of the template | |||
:;<var>attr</var>: the name of the attribute | |||
;Result: get the dialog flags defined for the attribute | |||
<code><var> | ==CheckFlag== | ||
;Usage: <code><var>instance</var> getflags <var>id ; attr ; flag</var></code> | |||
:;<var>id</var>: the id of the template | |||
:;<var>attr</var>: the name of the attribute | |||
:;<var>flag</var>: the flag to be tested | |||
;Result: '''1''' if the flag is set, '''0''' otherwise | |||
==== | ==Manage== | ||
;Usage: <code><var>instance</var> manage</code> | |||
;Result: none (void) | |||
;Description: Display the template management dialog. This dialog implements functions to view, edit (using a text editor), rename and delete templates. | |||
==GetVars== | |||
;Usage: <code><var>instance</var> getvars <var>id</var></code> | |||
== | :;<var>id</var>: the id of the template | ||
;Result: An extended table contains all the definitions of all variables of the selected template. The returns table has the string fields '''Type''', '''Name''', '''Default''', '''Values''' and '''Flags'''. | |||
<code><var> | |||
: | |||
; | |||
An | |||
Revision as of 11:32, 7 March 2018
- File: Classes.STX, linked to library STX.LIB
- Parent class: CObj
A class to manage templates (e.g. of type DialogTemplate, ASegTemplate or attrTemplate)
Contents
Create Instance
- Usage
ctemplates [ typetag ]
cobj new ctemplates [ typetag ]
- typetagselects the type of templates to be managed (default
- ASegTemplate)
- Result
- an initialized instance
Delete Instance
- Usage
instance destroy
- Result
- none (void)
GetTable
- Usage
instance gettable
- Result
- an extended table containing the id's of the available templates of the selected type (one per entry, field id)
GetList
- Usage
instance getlist
- Result
- an semi-colon separated list of the id's of the available templates of the selected type
GetAttributeList
- Usage
instance getattributelist id
- id
- the id of the template
- Result
- an blank separated list of attributes defined in the selected template
GetValueListForAttribute
- Usage
instance getvaluelistforattribute type ; id ; attr
- type
- selects type of result
- table: return a simple table containing on value per line; the default value is stored in the first line
- list: return a blank separated list of values
- id
- the id of the template
- attr
- the name of the attribute
- Result
- an blank separated list of defined values or a simple table containing one value per line (see argument type)
GetDefaultValueForAttribute
- Usage
instance getdefaultvalueforattribute id ; attr
- id
- the id of the template
- attr
- the name of the attribute
- Result
- the default value
GetFlags
- Usage
instance getflags id ; attr
- id
- the id of the template
- attr
- the name of the attribute
- Result
- get the dialog flags defined for the attribute
CheckFlag
- Usage
instance getflags id ; attr ; flag
- id
- the id of the template
- attr
- the name of the attribute
- flag
- the flag to be tested
- Result
- 1 if the flag is set, 0 otherwise
Manage
- Usage
instance manage
- Result
- none (void)
- Description
- Display the template management dialog. This dialog implements functions to view, edit (using a text editor), rename and delete templates.
GetVars
- Usage
instance getvars id
- id
- the id of the template
- Result
- An extended table contains all the definitions of all variables of the selected template. The returns table has the string fields Type, Name, Default, Values and Flags.