The newformobject statement creates a new graphic object in a form.


This statement has three parameters:

class – the type of object to create, for example RectangleShapeObject, TextDisplayObject, PushButtonObject, etc. (For a complete list of object types use the objectinfo("classnames") function, or see the Object Library in the bottom right of any graphics mode form window.) The newform statement is very forgiving about how you specify the class. The class name can be upper or lower case, spaces are ignored, and the name can be abbreviated as long as it is unambiguous. For example you could create a new web browser object by specifying WebBrowserObject, Web Browser, or just web. However, Panorama will not understand if you ask it to create a text object because that is ambigous – it could mean TextLabelObject, TextDisplayObject, TextEditorObject, or TextListObject.

property – The name of a property you want to specify for the new object. See Modifiable Object Properties for descriptions of the different properties that can be specified. You can specify multiple property/value pairs to set up your new object. It’s not necessary, however, to specify all properties for the new object – Panorama will fill in default values for any you leave off.

value – The value for the specified property. Note: Instead of specifying the property names and values as separate parameters, you can specify multiple properties with a dictionary. See the main text below for more information.


This statement creates a new graphic object in a form. You can create any kind of object you want, with whatever custom properties are needed. Here is a simple example that creates a 50 points by 100 points blue rectangle 1 inch from the top left corner of the form:

newformobject "Rectangle",
   "rectangle",rectanglesize(72, 72, 50, 100),

This example creates a mailing label template.

startgraphicschange "Create 5160 Mailing Label"
local labelRect
labelRect = rectanglesize(100, 100, 72, 72*2.75)
newformobject "ReportTile","Tile","Data Tile","Rectangle", labelRect
newformobject "TextDisplay",
    "Formula",{Name+cr()+Address+cr()+City+", "+State+" "+Zip}

This more complex example creates two rows of objects starting in the upper left corner of the form. The first row displays the name of each field. The second row contains a text editor for each field. The fields are spaced 4 points apart horizontally, and the titles and editors are 2 points apart vertically. Each column is an inch wide. (Note: The startgraphicschange statement allows this procedure to be undo-able.)

startgraphicschange "Create Row of Fields"
local fieldrect
fieldrect = rectanglesize(0, 0, 15, 72)
looparray dbinfo("fields",""),cr(),dbfield
    newformobject "TextDisplay",
    newformobject "TextEditor",
        "rectangle",rectangleoffset(fieldrect, rheight(fieldrect)+2, 0),
    fieldrect = rectangleoffset(fieldrect, 0, rwidth(fieldrect)+4)

This example uses native properties (see Modifiable Object Properties) to create a 15-point red star with a drop shadow.

newformobject "star",
    "rectangle",rectanglesize(100, 100, 200, 200),

You can also specify the options with a dictionary, like this:

newformobject "star",initializedictionary(
    "rectangle",rectanglesize(100, 100, 200, 200),

The advantage of using a dictionary is that you can set it up once and use it over and over again, like this.

local starOptions
starOptions = initializedictionary(
for n,0,5
    newformobject "star",changedictionaryvalues(starOptions,
        "rectangle",rectanglesize(20, 20+n*24, 18, 18),

This example creates a row of red stars, each 1/3rd inch to the right and rotated 30 degrees.

See Also


10.0NewThis statement is new in this version.