# Apostrophe Operator

> Source: https://manual.pvxplus.com/appendix/apostrophe-operator

## Formats

|  |  |  |
| --- | --- | --- |
| 1\. | *Assign Property:* | *object'property*\[$\]*=var*\[$\] |
| 2\. | *Retrieve Property:* | *var*\[$\]*=object'property*\[$\] |
| 3\. | *Call a Method:* | *var*\[$\]*=object'method*\[$\](*args*) |
| 4\. | *List of Available Properties or Methods:* | *var*$*=object*\* |

***Where***:

|  |  |
| --- | --- |
| **'** | Apostrophe operator (sometimes called a *tick*). |
| **\*** | Asterisk to produce a comma-separated list of properties/methods available for a particular object.<br>***Example:***<br>To list DROP_BOX properties (assuming *dbox* is a unique ctl_id):<br>print dbox'Auto,BackColour,Col,Cols,CurrentItem,CtlName,Enabled,Eom,Focus,Font,Height,hWnd,Item,ItemCount,ItemText,Key,Left,Line, Lines,Msg,OnFocusCtl,Parent,Sep,SepLoad,Tbl,TextColour,Tip,Top,Value,Visible,Width |
| *args* | Optional argument(s). |
| *method*\[$\] | Name of a valid method/function in the given control/object. Method names are not case sensitive. To query the list of available methods, use the above syntax for **\*** *(asterisk)*. |
| *object* | Numeric variable containing the control value (handle) for the object. |
| *property*\[$\] | Name of a valid property in the given control/object. Property names are not case sensitive. To query the list of available properties, use the above syntax for **\*** *(asterisk)*. |
| *var*\[$\] | String or numeric variable. |

Note:  
In the above syntax, ensure that numeric methods/properties correspond to numeric variables and that string methods/properties correspond to string variables; i.e. object'property$=var$ or var=object'method( ) on both sides of the equation.

## Description

An apostrophe operator *(tick)* allows ***dynamic*** access to the properties and methods available for a given \*BROWSER, COM, .NET, OOP or graphical object. While the syntax is generally the same for all object-oriented coding in PxPlus, the apostrophe operator can be used to read and alter properties or execute methods in a variety of different control and object types.

## Examples

***Example 1:***

This example creates a Multi-Line control, displays the properties available, changes the column width, and returns the current screen coordinates.

```
multi_line 100,@(10,12,40,1)
X=100
print X'Auto,BackColour,Col,Cols,CtlName,Enabled,eom,Fmt,Focus,Font,Height,hWnd,ImpliedDecimal,Key,Left,Len,Line,Lines,Lock,MenuCtl,Msg,Nul,OnFocusCtl,Parent,Scroll,SelectLength,SelectOffset, SelectText,sep,SignalOnExit,TextColour,Tip,Top,Uppercase,Value,Visible,Width,
X'Cols=50 ! Make control 50 columns wide
print X'Col,X'Line ! Current screen coordinates of the multi-line
10 12
```

***Example 2:***

This example creates a Grid control with 10 columns and 5 rows, and then selects column two, row zero (which selects the entire column). Changing the value of the property sets the contents of all the selected cells to that value.

```
grid 10,@(10,10,40,5)
Y=10
Y'ColumnsWide=10
Y'RowsHigh=5
Y'Column=2
Y'Row=0
Y'Value$="New Data"
```

***Example 3:***

This example dynamically changes a property in one object based on the value of another.

```
if Country.ctl'value$="CDN" \
     then Zip'Fmt$="A0A 0A0" \
     else Zip'Fmt$="00000"
```

***Example 4:***

This is a simple COM interface example that instantiates an Internet Explorer object and then displays the PVX Plus Web site.

```
def object IE,@(10,10,40,20)="Shell.Explorer"
IE'Navigate2(www.pvxplus.com)
```

***Example 5:***

This OOP example assumes the definition of a "Customer" object.

```
Cst=new("Customer")
Cst'Find("012345")
```

## See Also

**[PxPlus Event Handling](https://manual.pvxplus.com/automation-in-pxplus/events/overview#handlingevents)**  
[Control Object Properties](https://manual.pvxplus.com/control-object-properties)  
[Object Oriented Programming](https://manual.pvxplus.com/introduction/basic-concepts#Mark10)  
**[DEF OBJECT Define Windows Object](https://manual.pvxplus.com/directives/def-object)**  
**[External Controls - \*Browser, ActiveX (COM), PVX Plus, .NET](https://manual.pvxplus.com/nomads-graphical-application/creating-panel-controls/com-control/com-control)**
