Buttons
Draws one command button of a linelist as a worksheet shape. Create binds an anchor cell, a shape name and a button scope. Add draws the rounded rectangle at the position that scope gives, names it, puts a label on it and points its OnAction at a macro. Format hands the shape to LLFormat under the format that matches the scope.
THE THREE SCOPES
ButtonScopeLarge, ButtonScopeSmall and ButtonScopeGeo. The scope decides the width and the height of the shape, the offset from the anchor cell, and the format Format asks for.
WHAT IS REPORTED
Factory
Create #
create
Factory returning an initialised Buttons instance
Signature:
Public Function Create(ByVal outrng As Range, ByVal codeName As String, _
ByVal scope As Byte) As Buttons
Parameters:
outrng: Range. Anchor cell for the button.codeName: String. Name assigned to the shape.scope: Byte. ButtonScope controlling size and format.
Returns: Buttons. Ready to use.
Properties
OutputRange #
output-range
Anchor range used for placement
Signature:
Public Property Get OutputRange() As Range
Returns: Range. Top-left anchor cell.
OutputRange #
output-range-set
Update the anchor range used for placement
Signature:
Public Property Set OutputRange(ByVal rng As Range)
Parameters:
rng: Range. Providing the top-left anchor cell.
Name #
name
Shape name assigned in the worksheet
Signature:
Public Property Get Name() As String
Returns: String. Shape identifier.
ShapeScope #
shape-scope
Formatting scope applied to the button
Signature:
Public Property Get ShapeScope() As Byte
Returns: Byte. ButtonScope value.
Operations
Add #
add
Create the worksheet shape at the configured location
Signature:
Public Sub Add(Optional ByVal actionCommand As String = vbNullString, _
Optional ByVal shapeLabel As String = vbNullString)
Parameters:
actionCommand: String. Macro to invoke on click. Defaults to vbNullString.shapeLabel: String. Label displayed on the button. Defaults to vbNullString.
Format #
format
Apply the appropriate visual design to the button
Signature:
Public Sub Format(ByVal design As LLFormat)
Parameters:
design: LLFormat. Formatter responsible for styling the shape.
Checkings
HasCheckings #
has-checkings
Whether diagnostic entries have been recorded
Signature:
Public Property Get HasCheckings() As Boolean
Returns: Boolean. True when at least one entry exists.
CheckingValues #
checking-values
Retrieve the diagnostic log entries
Signature:
Public Property Get CheckingValues() As Object
Returns: Object. The checking instance, or Nothing.
Internal members (not exported)
Properties
Name #
name-set
Store the shape name assigned in the worksheet
Signature:
Public Property Let Name(ByVal nm As String)
Parameters:
nm: String. Identifier for the shape.
ShapeScope #
shape-scope-set
Store the formatting scope applied to the button
Signature:
Public Property Let ShapeScope(ByVal scope As Byte)
Parameters:
scope: Byte. ButtonScope value.
Shape Queries
ShapeExists #
shape-exists
Whether the button shape already exists on the worksheet
Signature:
Private Property Get ShapeExists() As Boolean
Returns: Boolean. True when the named shape is present.
ShapeObject #
shape-object
Retrieve the underlying shape or raise when absent
Signature:
Private Property Get ShapeObject() As Shape
Returns: Shape. Object representing the button.
Checkings
LogCheck #
log-check
Append a diagnostic entry to the internal checking log
Signature:
Private Sub LogCheck(ByVal label As String, _
Optional ByVal scope As Byte = checkingNote)
Parameters:
label: String. Message describing the issue or action.scope: Byte. Severity scope for the log entry.
Error Handling
ThrowError #
throw-error
Raise a typed project error
Signature:
Private Sub ThrowError(ByVal errNumb As Long, ByVal errorMessage As String)
Parameters:
errNumb: Long. ProjectError error code.errorMessage: String. Descriptive error message.
Seal #
seal
Seal the instance so setup setters can no longer be written
Signature:
Public Sub Seal()
GuardNotSealed #
guard-not-sealed
Guard a setup setter against writes after sealing
Signature:
Private Sub GuardNotSealed(ByVal propName As String)
Parameters:
propName: String. Name of the property being guarded.
Helpers
TargetRange #
target-range
Ensure the internal anchor range is available
Signature:
Private Function TargetRange() As Range
Returns: Range. Anchor used for calculations.
TargetWorksheet #
target-worksheet
Retrieve the worksheet hosting the button
Signature:
Private Function TargetWorksheet() As Worksheet
Returns: Worksheet. Containing the anchor range.
ResolveDimensions #
resolve-dimensions
Resolve button dimensions from the scope definition
Signature:
Private Function ResolveDimensions(ByVal scope As Byte) As TDimensions
Parameters:
scope: Byte. ButtonScope value.
Returns: TDimensions. Width and height in points.
ResolvePosition #
resolve-position
Compute the top-left coordinates for the button
Signature:
Private Function ResolvePosition(ByVal anchor As Range) As TPosition
Parameters:
anchor: Range. Positional reference.
Returns: TPosition. Left and top offsets.
EffectiveLabel #
effective-label
Determine the label displayed on the button
Signature:
Private Function EffectiveLabel(ByVal providedLabel As String, ByVal fallbackName As String) As String
Parameters:
providedLabel: String. Caller-provided label.fallbackName: String. Fallback when the label is blank.
Returns: String. Label text.
Used in (4 file(s))
- AnalysisOutput.cls
- Linelist.cls
- LLDataEntry.cls
- TestButtons.bas