PSEC - Powershell Enhanced Capability
Version 1.2.1

Elem Class (src: gui-classes.psm1)

Extended By

Area Gizmo

Description

Elem is the base object for both the Area Object and the Gizmo Object.

Details

Elem is the base object for both the Area Object and the Gizmo Object. It is the wrapper for the Peer Object which is the WPF Form Object the same name. For this reason the WPF Forms namespace cannot be used in this and other modules.

The peer.tag field points back at the Elem object.

Many standard methods are bound to this object. A few inspect the object they are called on behalf of and modify their behavoir accordingly. Alternately, the standard method's behavoir can be changed by overriding the method in the subclass.

Render Modifiers

  • Font
Set with the setFont Method.

Must be registered with

  • Color
Set with the backColor Method, foreColor Method. See ?@rgb@? to generate and register colors.

Set with the @x@Elem.peer.setBackColor and @x@Elem.peer.setForeColor to directly change the value Must be registered with

Note on Methods

Many methods are are 'Chainable' in that they return the Elem instance. This means several methods can be used using the return value of the previous method call.

If not used or not assigned to a $vbl cast to [void] to avoid PowerShell issues of "Cannot convert the "System.Object[]"


Public Fields

FieldFormatDescription
$bFill[boolean]: fill Gizmo to container. set $true by setFill Method
$bGizmo[boolean]: Gizmo not Area if true. set $true by specific constructor.
$bHaveCH[boolean] have installed onClick handler
$bHaveFH[boolean] have installed onFocusLost handler
$bHidden[boolean]: area not displayed. set by setHidden Method
$bHorz[boolean]: Use horizontal layout. set $true by setHorz Method
$bLayDirty[boolean]: rebuild layout, it is dirty. set $true when events require layout change.
$bUseVScr[boolean]: True if to manage Vert Scroll, Set externally.
$clickMate[ElemMate]: onClick with context. V2 handler superceeds onClick
$dynH[int32]EC9B28 - dynamic extra for scroll
$elemDisabled[boolean] future
$focusMate[ElemMate]: onFocusLost with context.
$form[Form]: owning form. null for form itself
$hgt[int32]: calculated height
$marTop[int32] inner margins of kids on first/last elem
$mate[Elem] To connect elems (eg clear link for logger)
$maxW[int32]EC9B28 - scroll support
$onClick[scriptblock] for clickable gizmos (Obsolete)
$par[Elem]: immediate parent. set by constructor
$peer[System.Object]: The Peer Object we manage with this class
$peerW[int32] Original peer size
$reqW[int32]EC9B28 - actual required
$tied[System.Object]: Related object (such as Task Class
$wid[int32]: calculated width

Method Index

ToString Returns a summary of the *Elem* instance

backColor sets the background (text) color of the *Elem* using the registered color $col. Chainable.

clickHandler Creates an onClick handler. If $em is null it removes the handler.

color returns color registered with @@m.Form-regColor

detailStr Returns a detailed summary of the *Elem* instance

dock sets the docking flag of the *Elem*. See @@link.layout-alg. Chainable.

focusHandler Creates an onLostFocus handler. If $em is null it removes the handler.

font returns font registered with @@m.Form-regFont

foreColor sets the foreground (text) color of the *Elem* using the registered color $col. Chainable.

hidePeer Hides or shows a *Elem* according to the $hide parameter. Chainable. The *Elem* still occupies space. See @@m.Elem-setHidden.

hook Insert *Elem* address into given object *hook* field. Chainable.

regName Register the `elem.name` using @@m.Form-regElem to be used by @@m.Form-findElem

setAbs sets the absolute width and height of the *Elem*. See @@link.layout-alg. Chainable.

setBackColor sets the background color of the *Elem*. Chainable.

setDisabled Enables or Disables an *Elem*. Only meaningful for @@c.Gizmo. Chainable.

setFill sets the $bFill flag to $true. See @@link.layout-alg. Chainable.

setFont sets the font of the *Elem* using a registered font style name. See @@m.Form-regFont. Chainable.

setForeColor sets the foreground (text) color of the *Elem*. Chainable.

setGap sets the left and right gap (padding). See @@link.layout-alg. Chainable.

setHidden Hides or shows a *Elem* and its @@link.peer according to the $hide parameter. Chainable. The *Elem* will not occupy space if hidden. See @@m.Elem-hidePeer.

setHorz sets the $bHorz flag to $true. See @@link.layout-alg. Chainable.

setMar sets the left and right margins to $x. sets top and bottom mat=rigins to $y. See @@link.layout-alg. Chainable.

setMar sets the left, right, top and bottom margins. See @@link.layout-alg. Chainable.

setMaxHgt sets the maximum height of the *Elem*. Required for scroll support. See @@link.layout-alg. Chainable.

setMaxWid sets the maximum width of the *Elem*. Required for scroll support. See @@link.layout-alg. Chainable.

setName sets the name of the *Elem*. Typically used to find element using @@m.Form-findElem. Chainable.

setPeer Used by a constructor to set the @@link.peer.

setText sets the text of the @@link.peer for the the *Elem*. Chainable.


ToString Method index (src: gui-classes.psm1)

Signature

[String] ToString ()

Description

Returns a summary of the Elem instance


backColor Method index (src: gui-classes.psm1)

Signature

[Elem] backColor ( [string]$col)

Parameters

Parameter Format Description

$col string color code

Description

sets the background (text) color of the Elem using the registered color $col. Chainable.


clickHandler Method index (src: gui-classes.psm1)

Signature

[Elem] clickHandler ( [ElemMate]$em)

Parameters

Parameter Format Description

$em ElemMate contextual mate

Description

Creates an onClick handler. If $em is null it removes the handler.

Details

The onclick handler will be passed the ?@Elem@? and the ctx object value from the ?@ElemMate@?

If the link is diabled the handler is not called even if this interface is called.


color Method index (src: gui-classes.psm1)

Signature

[string] color ( [string]$name)

Parameters

Parameter Format Description

$name string name to lookup

Description

returns color registered with regColor Method

Details


detailStr Method index (src: gui-classes.psm1)

Signature

[String] detailStr ()

Description

Returns a detailed summary of the Elem instance


dock Method index (src: gui-classes.psm1)

Signature

[Elem] dock ( [string]$dock)

Parameters

Parameter Format Description

$dock string parm description missing

Description

sets the docking flag of the Elem. See Layout Algorithm. Chainable.


focusHandler Method index (src: gui-classes.psm1)

Signature

[Elem] focusHandler ( [ElemMate]$em)

Parameters

Parameter Format Description

$em ElemMate contextual mate

Description

Creates an onLostFocus handler. If $em is null it removes the handler.

Details

The onLostFocus handler will be passed the ?@Elem@? and the ctx object value from the ?@ElemMate@?

This can be used to validate the input


font Method index (src: gui-classes.psm1)

Signature

[System.Drawing.Font] font ( [string]$name)

Parameters

Parameter Format Description

$name string name to lookup

Description

returns font registered with regFont Method

Details


foreColor Method index (src: gui-classes.psm1)

Signature

[Elem] foreColor ( [string]$col)

Parameters

Parameter Format Description

$col string color code

Description

sets the foreground (text) color of the Elem using the registered color $col. Chainable.


hidePeer Method index (src: gui-classes.psm1)

Signature

[Elem] hidePeer ( [boolean]$hide)

Parameters

Parameter Format Description

$hide boolean $true to hide, $false to reveal

Description

Hides or shows a Elem according to the $hide parameter. Chainable. The Elem still occupies space. See setHidden Method.


hook Method index (src: gui-classes.psm1)

Signature

[Elem] hook ( [Object]$obj)

Parameters

Parameter Format Description

$obj Object parm description missing

Description

Insert Elem address into given object hook field. Chainable.

Details

This legacy method allows an event handler to access an Elem


regName Method index (src: gui-classes.psm1)

Signature

[Elem] regName ()

Description

Register the elem.name using regElem Method to be used by findElem Method

Details

Chainable


setAbs Method index (src: gui-classes.psm1)

Signature

[Elem] setAbs ( [int32]$w, [int32]$h)

Parameters

Parameter Format Description

$w int32 width in pixels

$h int32 height in pixels

Description

sets the absolute width and height of the Elem. See Layout Algorithm. Chainable.


setBackColor Method index (src: gui-classes.psm1)

Signature

[Elem] setBackColor ( [string]$col)

Parameters

Parameter Format Description

$col string color code

Description

sets the background color of the Elem. Chainable.


setDisabled Method index (src: gui-classes.psm1)

Signature

[Elem] setDisabled ( [boolean]$disable)

Parameters

Parameter Format Description

$disable boolean $true to disable, $false to enable

Description

Enables or Disables an Elem. Only meaningful for Gizmo Object. Chainable.

Details

This is a virtual disabling and requires the GUI logic to ignore a 'disabled' element.


setFill Method index (src: gui-classes.psm1)

Signature

[Elem] setFill ()

Description

sets the $bFill flag to $true. See Layout Algorithm. Chainable.


setFont Method index (src: gui-classes.psm1)

Signature

[Elem] setFont ( [string]$fontName)

Parameters

Parameter Format Description

$fontName string registered font name. See

Description

sets the font of the Elem using a registered font style name. See regFont Method. Chainable.


setForeColor Method index (src: gui-classes.psm1)

Signature

[Elem] setForeColor ( [string]$col)

Parameters

Parameter Format Description

$col string color code

Description

sets the foreground (text) color of the Elem. Chainable.


setGap Method index (src: gui-classes.psm1)

Signature

[Elem] setGap ( [int32]$w, [int32]$h)

Parameters

Parameter Format Description

$w int32 width in pixels

$h int32 height in pixels

Description

sets the left and right gap (padding). See Layout Algorithm. Chainable.


setHidden Method index (src: gui-classes.psm1)

Signature

[Elem] setHidden ( [boolean]$hide)

Parameters

Parameter Format Description

$hide boolean $true to hide, $false to reveal

Description

Hides or shows a Elem and its Peer Object according to the $hide parameter. Chainable. The Elem will not occupy space if hidden. See hidePeer Method.


setHorz Method index (src: gui-classes.psm1)

Signature

[Elem] setHorz ()

Description

sets the $bHorz flag to $true. See Layout Algorithm. Chainable.


setMar Method index (src: gui-classes.psm1)

Signature

[Elem] setMar ( [int32]$x, [int32]$y)

Parameters

Parameter Format Description

$x int32 parm description missing

$y int32 parm description missing

Description

sets the left and right margins to $x. sets top and bottom mat=rigins to $y. See Layout Algorithm. Chainable.


setMar Method index (src: gui-classes.psm1)

Signature

[Elem] setMar ( [int32]$lft, [int32]$rgt, [int32]$top, [int32]$bot)

Parameters

Parameter Format Description

$lft int32 left margin width in pixels

$rgt int32 right margin width in pixels

$top int32 top margin width in pixels

$bot int32 bottom in pixels

Description

sets the left, right, top and bottom margins. See Layout Algorithm. Chainable.


setMaxHgt Method index (src: gui-classes.psm1)

Signature

[Elem] setMaxHgt ( [int32]$h)

Parameters

Parameter Format Description

$h int32 height in pixels

Description

sets the maximum height of the Elem. Required for scroll support. See Layout Algorithm. Chainable.


setMaxWid Method index (src: gui-classes.psm1)

Signature

[Elem] setMaxWid ( [int32]$w)

Parameters

Parameter Format Description

$w int32 width in pixels

Description

sets the maximum width of the Elem. Required for scroll support. See Layout Algorithm. Chainable.


setName Method index (src: gui-classes.psm1)

Signature

[Elem] setName ( [string]$name)

Parameters

Parameter Format Description

$name string name to lookup

Description

sets the name of the Elem. Typically used to find element using findElem Method. Chainable.


setPeer Method index (src: gui-classes.psm1)

Signature

[void] setPeer ( [System.Object]$peer)

Parameters

Parameter Format Description

$peer System.Object The Form Object

Description

Used by a constructor to set the Peer Object.


setText Method index (src: gui-classes.psm1)

Signature

[Elem] setText ( [string]$text)

Parameters

Parameter Format Description

$text string parm description missing

Description

sets the text of the Peer Object for the the Elem. Chainable.

PSEC - Powershell Enhanced Capability
1.2.1

Copyright © 2018-2021, 2022, Rexcel System Inc.

 

 

 

 

 

X