objectinfo(
PROPERTY
,
OBJECT
,
FORM
,
DATABASE
)

The objectinfo( function returns information about a graphic object: its location, size, color, font, etc.


Parameters

This function has four parameters:

property – the type of information (color, font, etc.) to return. See below for details.

object – this optional parameter identifies the object you want to get information about. If this parameter is omitted, the object must be defined in advance by an object, selectobjects or changeobjects statement (see below), or by the objectinfoarray( function. If this parameter contains text, it contains the name of the object (or «» for the object currently being displayed). If the parameter is numeric, it contains the object id.

form – the name of the form containing the object. If this parameter is blank, or completely missing, the current form will be used.

database – the name of the database containing the form. If this parameter is blank, or completely missing, the current database will be used.


Description

This function returns information about a graphic object: its location, size, color, font, etc. These properties are normally displayed and manipulated with the accessory palette (on the right side of graphic editor windows). If a property is visible in the accessory palette, a procedure can determine that property and act on it. (Technical note: The objectinfo( function actually uses the same code used by the accessory palette to access property values. This means that as future new versions of Panorama add new types of objects and new object properties, these properties will automatically be accessible from the *objectinfo(* function.)

A form may contain dozens of objects – how does the objectinfo( function know which one you are interested in? One method is to explicitly select the object by name with the object statement. This example finds out the font and text size of the object named MySpecialButton.

local myFont, mySize
object "MySpecialButton"
if info("found")
    myFont=objectinfo("font")
    mySize=objectinfo("textsize")
endif

If you know the name of the object you can get information about it by supplying the name as the second parameter to the objectinfo( function. This example displays the color of the Background Rectangle object (of course you must have created an object with this name, see Object Names).

message htmlrgbstr(objectinfo("color","Background Rectangle")

If you already know the ID of an object you can get information about it by supplying the ID as the second parameter to the objectinfo( function. This code is designed to be triggered when a button is pressed – it displays the title of the button (if any).

message objectinfo("title",info("clickedobjectid"))

The objectinfo( function can also be used to select objects that meet one or more criteria. The selectobjects statement scans the objects in the current form and selects some of them based on a formula. The formula can use the objectinfo( function to examine each object as it is scanned and decide whether or not the object should be selected. This example will select all objects in the top 3 inches of the form.

selectobjects rbottom(objectinfo("rectangle")) < 72*3

A final use for the objectinfo( function is to modify selected objects. The changeobjects statement scans the selected objects in the form (usually selected with the selectobjects statement) and modifies those objects based on a formula. By using the objectinfo( function in this formula, you can modify a property based on an existing value of the property. This example increases the text size of all objects that contain text larger than 18 points by six points. In other words, 24 point text will become 30 point, 36 point will become 42 point, etc.

selectobjects objectinfo("textsize")>18
changeobjects "textsize",objectinfo("textsize")+6
selectnoobjects

Object Properties

An object may have dozens of properties: its location, size, color, opacity, font, formula, etc. The objectinfo( function returns just one of these at a time, specified by the property parameter.

Standard Object Properties

There are nearly two dozen standard properties that objectinfo( knows about. (Note: standard properties can be specified in either upper or lower case, or a mixture. In other words, info("font"), info("Font") and info("FONT") all specify the same property, the font name).

“alignment” - If an object contains content that can be aligned (text or images) this property may be "Left", "Center" or "Right".

“class” - This is the object’s type: "RectangleShapeObject", "PushButtonObject" "TextEditorObject" etc.

“color” - The color of the object (see Colors). For example, this procedure selects all objects with brightness below 50%.

selectobjects brightness(objectinfo("color"))<32768

“controlsize” - A number of “widget” objects come in three sizes: Regular, Small and Mini (these sizes are defined by Apple). The controlsize property returns the size value for the specified object. If the object doesn’t have a control size, this property will be empty.

“disabled” - This property will be true or false depending on whether or not the object currently corresponds to clicks. Objects that can be disabled include push buttons, checkboxes, radio buttons, pop-up menus, sliders, steppers, segmented buttons and tab panels.

“expandable” - This property will be true or false depending on whether or not the object can expand depending on the amount of data to be printed (see Variable Height Records).

“expandshrink” - This property will be true or false depending on whether or not the object can expand and shrink depending on the amount of data to be printed (see Variable Height Records).

“fieldname” - If an object is linked to a field or variable (for example Text Editor objects, Data Buttons, Popup Buttons, etc.), this property contains the name of the field or variable.

“formula” - If an object is displays information via a formula (for example Text Display objects, Image Display objects, etc.), this property contains the text of the formula.

“font” - If an object displays or edits text, this property contains the name of the font (for example "Times-Roman" or "Verdana").

“id” - This property is a unique number that can be used to identify this object later. The number is valid as long as the form is not modified. The objectid statement can use this unique ID number to re-locate this object later.

“linewidth” - This property is the width of the object border, if any (in points).

“locked” - This property will be true or false depending on whether or not the object is locked.

“name” - This property is the name of the object, if one has been assigned (see Object Names).

“opacity” - This property is the opacity of the object, a number from 0 (completely transparent) to 100 (fully opaque).

“procedure” - This property is the source code associated with the object. (All objects have procedures associated with them.

“properties” - This returns a dictionary of all of the object’s native properties (see below for more information about native properties).

“propertynames” - This returns a carriage return delimited array listing the names of all of the object’s native properties (see below for more information about native properties).

“rectangle” - This property is the dimensions of the object (location and size). This example selects all objects that are an inch or more high.

selectobjects rheight(objectinfo("rectangle") >= 72

See Graphic Coordinates to learn more about rectangles in Panorama.

“selected” - This property is only meaningful when used in the selectobjects statement. It will be true or false depending on whether or not the object was already selected. This example will reverse the previous selection – any objects that were selected will no longer be, and vice versa.

selectobjects not objectinfo("selected")

“textsize” - If an object displays or edits text, this property returns the size of the text.

“tile” - If an object is a Report Tile, this property is the type of tile, for example "Data Tile", "Summary Tile" or "Top Margin". For any other type of object this property is empty.

“title” - If an object is a button, this property is the title of the button (if any). For any other type of object this property is empty.

Composite Properties

The objectinfo( function also supports several composite properties. These are not based on a single object, but on an entire form or even Panorama itself. You don’t need to have a selected object to access these properties.

“boundary” - This property is the minimum rectangle that encloses all of the currently selected objects.

“classes” - This property lists all of the object types that can be created with the NewFormObject statement. The list is returned as a carriage return separated array. (Technical Note: There are actually two types of objects that are not returned in this list because they cannot be created with NewFormObjectGroupObject and StaticImageObject. These types can be returned by the objectinfo("class") function, however.)

“count” - This property is the number of objects that are currently selected.

“countall” - This property is the total number of objects contained in the form.

Native Object Properties

Each type of object also has its own native properties beyond the standard set. Some complex objects have dozens of properties. To access a native property, prefix the name with a $ symbol, like this:

objectinfo("$<native property name>")

Here are some examples of typical native properties:

objectinfo("$PolygonCorners")
objectinfo("$TextDisplayVerticalTextAlignment")
objectinfo("$PushButtonTitle)
objectinfo("$ImageDisplayAlignment")

Important Note: Native properties are case sensitive. For example, to access the number of corners a polygon object has, you must use "$PolygonCorners". It won’t work if you use "polygoncorners", "POLYGONCORNERS", or any other combination of upper and lower case.

You can literally access any property of an object with native properties. Because there are so many native properties, and because they are constantly evolving as Panorama changes, we’re not explicitly documenting them here. However, you can use the objectinfo("propertynames") function to get a list of all of the available native properties for an object. You can also use the objectinfo("properties") function to return a dictionary that contains all of the properties and their values. For example, suppose your form contains an object named testObject, you could use this procedure to display a list of all of this object’s properties.

object "testObject"
displaydata dumpdictionary(objectinfo("properties"))

Here’s what the output would look like for a typical push button object.

Color="3AAB27"
Class="PushButtonObject"
Fill="Solid"
FontSize="13 px"
PushButtonTransparent="0"
Opacity="100 %"
PushButtonDefaultButton="0"
ShadowBlur="10"
SizeHeight="185 px"
Stroke="None"
PushButtonStyle="Push Button"
StrokeWidth="1 px"
TextAlignment="Center"
Name="testObject"
LocationX="369 px"
SizeWidth="185 px"
FontName="LucidaGrande"
Procedure=""
ProcedureStatus="Ok"
PushButtonSize="Regular"
PushButtonTitle="Button"
ShadowOpacity="75%"
ShadowBrightness="0%"
DropShadow="0"
Locked="0"
PushButtonSystemFont="1"
ShadowAngle="45"
LocationY="173 px"
ShadowDepth="6"

You’ll notice that some of these native properties are the same as the standard properties for the object – for example LocationX, Color, FontName, etc. Panorama actually generates the standard properties from the native properties for you as a convenience, but the native properties are the fundamental properties for the object.

All native properties are represented as text values, even if the underlying property is numeric or Boolean. Boolean (yes/no) values are represented as either 0 (no) or 1 (yes).

Accessing the Currently Displayed Object

If the objectinfo( function is used inside the formula for a Text Display, Image Display, Web Browser, Segmented Button or Tab Panel object, it can refer to object itself by using "«»" as the object name. For example, here is a formula that could be used in a Segmented Button object to change the button arrangement as the width of the object changes (for example if the form is elastic). If the button is less than 200 points wide, only the Red and Green segments will be displayed, but if it is wider than 200 point, the Blue button will also appear.

"Red"+cr()+"Green"+
    ?(rwidth(objectinfo("rectangle","«»"))>200,cr()+"Blue","")

Error Messages

objectinfo( function requires a selected object. – To use this function there must be a selected object. Use the object, selectobjects or changeobjects statements to specify a selected object.


History

VersionStatusNotes
10.1UpdatedThis function can now easily access information about the object that is currently being displayed. Use the name «» to refer to this object. See "Accessing the Currently Displayed Object" for further details.
10.0UpdatedCarried over from Panorama 6.0, but with substantial changes to list of supported options. Options that are no longer supported include "type" (use "class" instead), "custom" (use "class" instead), "fillpattern", "linepattern". This function also now allows you to supply a second parameter that directly specifies the object, instead of using an external statement to specify the object, and you can also specify the form and database that contain the object.