Table of Contents

Understanding Behavior Region Advanced Properties

Behavior Region Editor Advanced Properties Tab allow setting parameters that allow detecting color dominance or ContentObject lookfors within a Behavior Region. These settings are available from the Behavior Region Editor's Advanced Properties tab.

Detecting Color Dominance

Color dominance means that of all the pixels in region, pixels with the specified color are the most numerous.

Note you can generically determine if a Behavior Region is all the same color using:

ContentObject.IsSameColor

Be careful with this because a cursor blinking in "an empty field", would be detected! So your Behavior Region here needs to not go all the way to the left side of the field.

Detecting color dominance works especially well for Meditech Expanse. Note that you can add these Behavior Regions, automatically using the procedure described here as you create ContentObjects for text fields.

Meditech Expanse uses specific colors to indicate to the user a text field is has focus, is selected or is disabled. By having behavior regions that detect these colors, you can have a single ContentObject for a given field but do different things based on the state (dominate color) of the behavior region.

The default focus color for Meditech is

FocusRed = 180 FocusGreen = 255 FocusBlue =168

Default disabled color is

DisabledRed=224 DisabledGreen = 224 DisabledBlue = 244

Color dominance detection can also be useful for other applications but you will need to determine the RGB values for the desired color (MS Paint is a great tool for this)

BehaviorRegion color properties are individual for red green and blue. Logically these are grouped by purpose and ContentObject has corresponding methods to evaluate color purposes.

Note that realistically the concept of Color Purpose is just to allow storing different colors. There is nothing "special" so you can borrow for example Focus to store a color for some purpose unique to you in order to use for example PauseFocusColor.

The "Has" methods perform a ContentObject.Exists() and then does a one time check for color dominance. PauseFocusColor calls Exist() and then also pauses to see if the Behavior Region becomes dominated by the color. ClickPause methods call Exist(), click into the Behavior Region,then pauses for the color dominance.

Color Purpose Behavior Region Properties ContentObject Color Purpose Methods
Focus FocusRed
FocusGreen
FocusBlue
PauseFocusColor
ClickPauseFocusColor
ClickPauseFocusColorTabData
HasFocusColor
Selection SelectionRed
SelectionGreen
SelectionBlue
HasSelectionColor
Disabled DisabledRed
DisabledGreen
DisabledBlue
HasDisabledColor

Manually Editing Colors

Edit the Behavior region, select Advanced Properties and edit the specific Color using either the defaults described above for Meditech Expanse, or if needed any bespoke RGB color. Pasting a screen shot into MS Paint and using the color picker is good approach for determining a bespoke color.

Color Exists Points

It can be useful just to know if a specified color exists within an area of the screen. This technique can for example roughly determine if a field is populated with text. In the below example we have a ContentObject named SigCheck - the use case is this was a field that may have a hand written signature and the automation needed to verify if the signature exists. This is accomplished by scanning for the existence of black pixels within the Behavior Region.

Dim br As BehaviorRegion
Dim rect As BWS10.Rectangle
Dim blackPts
 If C.SigCheck.Exists() Then
        Set br = C.SigCheck.GetBehaviorRegionFromInstance(C.SigCheck.FirstFoundInstance)
        Set rect = br.GetBWS10BehaviorRectangle
        C.Troubleshooter.ShowBWS10Rectangle rect, 1
        Set blackPts = C.ImageUtils.GetColorExistsBWS10Pts(1, 0, 0, 0, 250, rect)
        If blackPts.Count>0 then
        'The signature exists'
        End If
    End If

Detecting a ContentObject's Lookfor

The idea here is, you create a common ContentObject and you want to see "Hey does its lookfor exist inside the Behavior Region of some other ContentObject".

There are all sorts of situations this idea could be usedful for example: Here is what a cursor looks like, is it in my field? Here is what a checkmark looks like, is my checkbox checked?

And yes, this absolutely is an area of functionality that will be embraced and used moving forward. Don't worry, the plan is just to make this idea easier to implement, how it works won't go away.

Step 1. Create and robustly test your common ContentObject

Step 2. Right click this ContentObject and select Copy

Step 3. Create your ContentObject that needs this feature. IMPORTANT when defining the Behavior Region that will evaluate for the common ContentObject - be sure it is bigger and covers where this common ContentObject logically should uniquely exist.

Step 4: Edit that Behavior Region, Select Advanced Properties and paste in the ContentObjectID into LookforContentObjectID. Click into some other field in the property grid to set the value.

Once set you can use this with the following ContentObject methods. All of these first call Exists().

HasContentObjectLookFor LeftClickCOLookfor DoubleLeftClickCOLookfor TripleClickCOLookfor RightClickCOLookfor DoubleRightClickCOLookfor