WklFormatRules
WklFormatRules class
Signature
Dim myWklFormatRules As WklFormatRules
Summary
The conditional formatting rules of a tree list.
Parameters
None
Remarks
Returned by WklTreeList.FormatRules. Supports For Each. Rules are checked in collection order; a matching rule with StopIfTrue ends the check.
Not created directly; returned by other members of the library.
| Member | Kind | Summary |
|---|---|---|
| `Item` | Property | Returns a rule by position. |
| `Count` | Property | Returns the number of rules. |
| `Add` | Method | Adds a rule for the value of a column: a comparison, a data bar or an icon set. |
| `AddExpression` | Method | Adds a rule with an expression in Access syntax. |
| `Remove` | Method | Removes a rule. |
| `Clear` | Method | Removes all rules. |
Code example
With Me!List1.Object.FormatRules
.Add("Price", wrkValue, wroGreater, 30).Bold = True
.AddExpression("[Quantity] < [MinimumStock]").ForeColor = vbRed
End With
Inheritance
None
Item property
Signature
Property Get Item(ByVal Index As Long) As WklFormatRule
Summary
Returns a rule by position.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Index | Long | No | – | The 0-based position. |
Property value: `WklFormatRule` – The rule.
Remarks
Default member: it can be left out, as in myWklFormatRules(...) for myWklFormatRules.Item(...). Read-only.
Code example
None
Inheritance
Declared by WklFormatRules.
Count property
Signature
Property Get Count() As Long
Summary
Returns the number of rules.
Parameters
None
Property value: Long – The number of rules.
Remarks
Read-only.
Code example
None
Inheritance
Declared by WklFormatRules.
Add method
Signature
Function Add(ByVal Column As String, Optional ByVal Kind As WklRuleKind = wrkValue, Optional ByVal Operator As WklRuleOperator = wroEqual, Optional ByVal Value1 As Variant, Optional ByVal Value2 As Variant) As WklFormatRule
Summary
Adds a rule for the value of a column: a comparison, a data bar or an icon set.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Column | String | No | – | The name of the column whose value is checked and formatted. |
Kind | `WklRuleKind` | Yes | wrkValue | The kind of rule; default wrkValue. |
Operator | `WklRuleOperator` | Yes | wroEqual | The comparison for wrkValue; default wroEqual. |
Value1 | Variant | Yes | – | The value to compare with. |
Value2 | Variant | Yes | – | The upper limit for wroBetween and wroNotBetween. |
Return value: `WklFormatRule` – The new rule; set its format properties (ForeColor, Bold …) on it.
Remarks
None
Code example
None
Inheritance
Declared by WklFormatRules.
AddExpression method
Signature
Function AddExpression(ByVal Expression As String, Optional ByVal Column As String = "") As WklFormatRule
Summary
Adds a rule with an expression in Access syntax.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Expression | String | No | – | The expression, for example [Quantity] < [MinimumStock]; field names in square brackets. |
Column | String | Yes | "" | The column to format; empty to format the whole record. |
Return value: `WklFormatRule` – The new rule.
Remarks
None
Code example
None
Inheritance
Declared by WklFormatRules.
Remove method
Signature
Sub Remove(ByVal Index As Long)
Summary
Removes a rule.
Parameters
| Name | Type | Optional | Default | Description |
|---|---|---|---|---|
Index | Long | No | – | The 0-based position. |
Remarks
None
Code example
None
Inheritance
Declared by WklFormatRules.
Clear method
Signature
Sub Clear()
Summary
Removes all rules.
Parameters
None
Remarks
None
Code example
None
Inheritance
Declared by WklFormatRules.