SaveObject

Description

Occurs when the server application saves the object in the control.

Event ID

Event ID

Objects

pbm_omnsaveobject

OLE

Arguments

None

Returns

Long. Return code: Ignored

Usage

Using the SaveObject event is the preferred technique for retrieving the ObjectData blob value of an OLE control when the server saves the data in the embedded object. Unlike the Save and Close events, the SaveObject event does not require you to post a user event back to the control to prevent the generation of a runtime error.Because of differences in the behavior of individual servers, this event is not triggered consistently across all server applications. Using Microsoft Word or Excel, the SaveObject event is triggered when the DisplayType property of the control is set to DisplayAsActiveXDocument! or DisplayAsIcon!, but not when it is set to DisplayAsContent!. For other applications, such as Paint Shop Pro, the event is triggered when the display type is DisplayAsContent! but not when it is DisplayAsActiveXDocument!.

Because some servers might also fire the PowerBuilder Save event and the relative timing of the two events cannot be guaranteed, your program should handle only the SaveObject event.

Examples

Example 1

In this example, when the user or the server application saves a Word document in an OLE control, the data is saved as a blob in a file. The file can then be opened as a Word document:

blob  l_myobjectdata
l_myobjectdata = this.objectdata
integer  l_file

l_file = FileOpen("c:\myfile.doc", StreamMode!, Write!)
FileWrite( l_file, l_myobjectdata )
FileClose( l_file )

See also