| Search Locate Previous Next | Contents |
Finally, we can come back to the incident log, and allow the user to add entries to our table. A good format would seem to be the Dyalog grid, which is probably the most complex Causeway class to use. Here is what the finished update screen might look like:
The first column uses the Dyalog date field, the second is a simple text edit. Here is the function to call it:
Log inx;log;name
[1] © Update incident log for this record
[2] loginxlog
[3] © Add a new entry for today
[4] log®þ(cal_ts 3TS)''
[5] nameinxnames
[6]
(0=#.CPro.Call dbx_log)0
[7] © Update with new data
[8] (inxlog)log
I find this the simplest way of handling an OK/Cancel dialogue, but it does have the disadvantage that I cannot test the dialogue box without running this function to call it as my temporary copies of the global data are normal APL locals. An alternative would be to pass log and name as arguments to CPro.Call, and get back an explicit result with the return code (1=OK, 0=Cancel) and the updated log entry. The dialogue design is more or less trivial except for the way the Text Matrix class is specified:
Disp dbx.lg[1 2;1 2 5]ÚÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ
ÛFMÛIncident LogÛÚÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ Û
Û Û ÛÛGroups Û{LOG} Û Û
Û Û ÛÃÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ Û
Û Û ÛÛTitlebarÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛ Û
Û Û ÛÛ ÛÛExpressionÛIncidents for ,nameÛÛ Û
Û Û ÛÛ ÛÃÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝÛ Û
Û Û ÛÛ ÛÛDependenceÛ{name} ÛÛ Û
Û Û ÛÛ ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛ Û
Û Û ÛÀÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ Û
ÃÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ
ÛTMÛ ÛÚÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛ
Û Û ÛÛStyle Û{Smalltext} ÛÛ
Û Û ÛÃÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝÛ
Û Û ÛÛValues ÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÌ ÛÛ
Û Û ÛÛ ÛÛExpressionÛlog Û ÛÛ
Û Û ÛÛ ÛÃÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÝ ÛÛ
Û Û ÛÛ ÛÛDependenceÛ{log}Û ÛÛ
Û Û ÛÛ ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÙ ÛÛ
Û Û ÛÃÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝÛ
Û Û ÛÛSpecificationÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛÛ
Û Û ÛÛ ÛÛExpressionÛ(domains dt tx... ÛÛÛ
Û Û ÛÛ ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛÛ
Û Û ÛÀÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛ
ÀÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ
The full specification expression for the TM class is:
('domains' 'dt' 'tx')('coltitles' 'Date' 'Notes')
... which is standard Dyalog (Property,value) pair syntax with one extra entry for a Causeway property Domains. The Dyalog grid is an extremely powerful programming tool, but unfortunately it makes it very hard to implement really simple tools like column-based editors. The idea of the Causeway domain is that it holds in one place all you need to know to set up a column of data with a particular behaviour.
It is simply a reference into a table of field types, for example:
Disp #.Class.domain[1 2 3 5 6;]ÚÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÂÎÎÎÎÎÂÎÎÎÎÎÎÎÌ
ÛTypeÛDescription ÛSpecification ÛNewÛWidthÛShowInpÛ
ÃÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÏÎÎÎÎÎÏÎÎÎÎÎÎÎÝ
ÛNM ÛNumeric Cell Û{EditÛ{FieldTypeÛNumeric}Û{ValidIfEmptyÛ1}} Û0 Û48 Û1 Û
ÃÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÏÎÎÎÎÎÏÎÎÎÎÎÎÎÝ
ÛN2 ÛNumeric 2dpl Û{EditÛ{FieldTypeÛNumeric}Û{DecimalsÛ2}Û ...}} Û0 Û64 Û1 Û
ÃÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÏÎÎÎÎÎÏÎÎÎÎÎÎÎÝ
ÛTX ÛText Edit CellÛ{EditÛ{FieldTypeÛChar}} Û Û144 Û1 Û
ÃÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÏÎÎÎÎÎÏÎÎÎÎÎÎÎÝ
ÛDT ÛDate Cell Û{EditÛ{FieldTypeÛDate}Û{ValidIfEmptyÛ1}} Û1 Û72 Û1 Û
ÀÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÁÎÎÎÎÎÁÎÎÎÎÎÎÎÙ
... so the DT field defaults to 72 pixels wide, and gets day-1 as its fill value when the user adds a new row of data. You can modify or add to this table with your APL application for example you might like to patch in todays date as the fill element when you start the main form.
If the grid specification gets very complex, a good strategy is to make a niladic, result-returning function such as:
rgrid_log
[1] © Set parameters for log grid
[2] r('domains' 'dt' 'tx')
[3] r,('coltitles' 'Date' 'Notes')
... which makes the settings much easier to edit. Now you can simply set this function as the reference expression for the grid.