windowreferencecontrol

Inherits

windowcontrol

Inherited By

windowreferencefield

Context

windowinstance

This control acts like a button and is used to open a new window.

The value contained in the control is a combination of a string specifying a window class name and a string specifying a database identifier relative to the window source (the latter being called the control's record source).

The windowclass and data source of the created window will match the ones specified in the definition, or the ones in the contained shortcut value. If the record source is undefined and the window has a data source defined, the opened window's data source will be the same as that of the window containing the control. This last feature is useful for opening different views on the same data or for opening contained data in a new sheet from a windowlist entry.

This control supports the "shortcut" dragdata type.


Definition

<windowreferencecontrol > <icon > <normal > ... </normal> <empty > ... </empty> <pressed > ... </pressed> </icon> <description > <text > ... </text> OR <textres > ... </textres> OR <control > ... </control> OR <field > ... </field> </description> <class > <recordname > ... </recordname> </class> <noreset /> <nodrag /> <allowdrop /> <closetoggle /> </windowreferencecontrol>

<windowreferencecontrol >

 

<icon >

The bitmap rendered in the control

<normal > ... </normal>

The name of the icon resource used when the control is in the normal state and contains a value

<empty > ... </empty>

The name of the icon resource used when the control contains an empty value

<pressed > ... </pressed>

The name of the icon resource used when the mouse button is pressed on the control

</icon>

 

<description >

The source of the description string added to a drag started in this control

<text > ... </text> OR

A static text string

<textres > ... </textres> OR

String resource ID

<control > ... </control> OR

Name of a control with the same parent window that should be used fro description text

<field > ... </field>

A relative (to the window data source) database identifier pointing to a field that contains the description text

</description>

 

<class >

The name of the window class used for an opened window instance

<recordname > ... </recordname>

A relative (to the window data source) database identifier pointing to the data source to assign to the opened window

</class>

 

<noreset />

Disable reset by using the middle mouse button

<nodrag />

Disable drag from this control

<allowdrop />

Allow drop operations to set the shortcut data contained in the control

<closetoggle />

Activating the control with the target window instance already in existance will cause the window to close if this is specified

</windowreferencecontrol>

 

Interface

activate

function activate()

Emulates the activation of the window reference, opening a new window, if one corresponding to the specified target is not found, or bringing the window to the top in the draw order if it is already open.

Return values

(windowinstance)
windowinstance object representing the shortcut stored in this control, or nil if not found or invalid shortcut data.

getTargetDatabaseNode

function getTargetDatabaseNode()

This function can be used to fetch the database node used if the window reference were activated.

Return values

(databasenode)
A reference to a databasenode object representing the data source of the shortcut, or nil if is not found or specified.

getValue

Returns data about the shortcut stored in the control.

Return values

(string)
The name of the windowclass used for the shortcut(string)
The database identifier used for the shortcut

onValueChanged

If present, this function is executed whenever the value of this control changes.



setIcons

Set the icons for the normal and pressed states of the control.

Parameters

normal   (string)   

The name of an icon resource drawn in the control in the normal state

pressed   (string)   

The name of an icon resource drawn in the control when the mouse is pressed down on the control



setValue

Sets the shortcut stored in the control.

Parameters

class   (string)   

The name of the windowclass used for the shortcut

recordname   (string)   

The database identifier used for the shortcut. If this parameter is omitted, an empty value will be used indicating that the window data source should be used.