The PowerBuilder Context object allows applications to access certain host (non-PowerBuilder) services:
- Context information service (available on all platforms)
- Keyword service (available on all platforms)
- Internet service (available on Windows 95 and Windows NT only)
These services provide environment-specific functionality for the following environments (also called contexts):
- PowerBuilder execution time (default context)
- Window plug-in
- Window ActiveX
All aspects of each service may not be available in all contexts. Powersoft may provide additional services after the release of PowerBuilder 6.0. Additionally, you can write your own services by creating descendants of the service object.
Similar to the COM QueryInterface
This feature provides functionality similar to the COM QueryInterface.
Use this feature to enhance the capabilities of your applications. For example, by using the functions provided by the services, you can:
- Open the default browser, displaying a URL from within a PowerBuilder application
- Access application arguments and environment variables
- Control the browser from within a PowerBuilder application
- Determine the execution context, modifying the application's look, feel, and processing depending on the environment
You begin by instantiating one of the services through the GetContextService PowerScript function. This function takes an argument specifying the requested service and returns a reference to the instantiated service. In this example, the Context object instantiates the context information service for use within a window (icxinfo_base is a window-level instance variable of type ContextInformation):
You can then use the reference variable in dot notation to call functions for the ContextInformation object.
At execution time, the Context object determines the current execution environment and enables the requested service as appropriate for the environment.
This table describes basic usage for each of the services:
Access basic information on the current execution context. Sample contexts include native PowerBuilder execution environment, window plug-in, and window ActiveX. When running the window ActiveX within Internet Explorer, this service can also access the IWebBrowserApp ActiveX automation server object, which provides access to browser methods and properties
Access environment information for the current context. When running within the window plug-in, this service allows you to access parameters specified in the plug-in's Embed element
Display a URL in the default browser. This service also allows you to get and post URLs
To enable a service:
For more information
Context object detail