Using customizations
Customizations can be used in expression blocks.
Example |
// The result is assigned to @tmp impl = expression { cooobj.GetObjHint(cooobj.objclass, @suffix, &@tmp); } // build is declared as retval, thus the result can be assigned directly impl = expression { string @tmp = cooobj.GetObjHint(cooobj.objclass, @suffix); } // The result is a list of matching customizations assigned to @result impl = expression { GetAllowedAttrDef[] @result = cooobj. GetAllowedAttrDef(cooobj.objclass, null)[...]; } |
Note:
- The key parameters are used to evaluate which customization should be used. If a parameter is an object class, the inheritance is taken into account (best match).
- If a parameter is defined as retval direct assignments are possible.
- If an output parameter is omitted, its value is not calculated due to performance reasons.
- If you need to access all matching configuration entries you can access this list by using “[...]” to qualify the result of the customization point.
Concise example
This concise example subsumes the concepts described in the above chapters. The goal is to customize the hint that is displayed when moving the mouse over a content object.
Example |
app.ducx Customization Language GetObjHint ( key ObjectClass objclass, string suffix, retval string hint ); customize GetObjHint<ContentObject> { hint = expression { return cooobj.GetHTMLLine(#objname, cooobj.objname) + cooobj.GetHTMLLine(#objowner, cooobj.objowner.objname); } } app.ducx Use Case Language // Override COOATTREDIT@1.1:GetObjectHint override GetObjectHint { variant ContentObject { impl = expression { // Call customization point cooobj.GetObjHint(cooobj.objclass, null, &text); } } } GetHTMLLine(AttributeDefinition attrdef, any value, retval string line) { variant Object { impl = expression { line = "<b>"; line += attrdef.objname; line += ":</b> "; line += STRING(value); line += "</br>"; return line; } } } |