PB Application objects and configuration files

Source: Internet
Author: User

//////////////////////////////////

Application Object

[Others]

■ Learning events should begin with the following:
Event trigger time
Event Parameters
Event Return Value
Common Programming in events
Event Functions


[Attribute]

▲Appname and displayname
These two attributes are of the string type. The appname Application Object Name is defined when an application object is created and cannot be modified. You cannot use scripts to modify the attributes during running. Displayname is an attribute set for programming convenience. You can modify it as needed. Its default value is appname.

▲Microhelpdefault
This attribute is used to set the prompt information at the bottom of the window in the default state, which is a string type attribute. The default value of this attribute is ready. This attribute is valid when you create a multi-document application (MDI.

▲Dwmessagetitle
This attribute is a string type attribute used to set the title of the message dialog box in the data window during running.
For example, if you fill in string data in the long column in the data window, a dialog box titled datawindow error is displayed. This attribute modifies the title.

▲Ddetimeout
This attribute is an integer property that is used to set the maximum response time that a customer waits to connect to the server when Pb is used as a Dynamic Data Exchange (Dynamic Data Exchange. Applicable only to Windows Platforms

▲Righttoleft
This attribute is a Boolean attribute used to set the display sequence of MessageBox () function text.

▲Freedblibraries
This attribute specifies whether to release the interface library resources in the memory after the database is disconnected. The default value is false, indicating that the interface library resources are not released.

▲Additional properties (additional attributes)
Additional attributes are used to set fonts, application icons, and global variables.

▲Toolbar attributes
Toolbarframetitle: Set the title for floating display of frame Toolbar
Toolbarsheettitle: Set the title when the sheet toolbar is displayed floating
Toolbarpopmenutext: Set the content of the pop-up menu on the toolbar
Toolbarusercontrol: sets whether users can use the right-click pop-up menu to set related properties of the toolbar.
Toolbartext: whether to display toolbar text
Toolbartips: Indicates whether a prompt is displayed after the mouse stays on the toolbar for a short time.


[Event]

◆ Open ()
This event is triggered when the application is running. The event parameter is CommandLine, indicating the processing after the application starts. The event does not return a value. There must be a script under the application's open event, otherwise the application will not do anything. A typical script for this event is to connect to the database, verify the user identity and password, and open the main operation window.
Database Connection in open:
// Profile northwind
Sqlca. DBMS = "MSS Microsoft SQL Server 6.x"
Sqlca. Database = "northwind"
Sqlca. logpass = "cwd637000087"
Sqlca. servername = "CWD"
Sqlca. logid = "sa"
Sqlca. autocommit = false
Sqlca. dbparm = ""
// The following is generally not used
Sqlca. userid = ""
Sqlca. dbpass = ""
Sqlca. Lock = ""
Connect using sqlca;

Sqlca. sqlcode = 0 // database connection successful
-1 // database connection Error
100 // The connection is successful, but no data is retrieved (usually used in DW)

◆ Close ()
This event is triggered when the user closes the application. This event has no parameters or return values. The typical script in this event is to cancel the database connection and delete the objects created using the script.
Disconnect;
Destroy Object Name

◆ Idle ()
After the function idle () is called, this event is triggered when no keyboard operation or mouse movement time is specified by the idle function. This event has no parameters or return values. Function idle () can be used in any window or script of the application. The typical scripts in this event perform confidentiality processing, such as entering the screen protection status, re-entering the user identity verification and password verification window, restarting or exiting the application.

◆ Systemerror ()
This event is triggered when a serious error occurs during program execution. For example, calling non-existent objects (this often happens when a large application system is developed, because useful objects are deleted ). This event has no parameters or return values. When an error occurs and the script is not processed in the systemerror event, the application displays the error code and error information in the error object of PowerBuilder.
Error. Number // error code
Error. Text // error message
Error. windowmenu // error window, menu
Error. Object // Error Control
Error. objectevent // error event
Error. Line // Number of error rows

◆ Connectionbegin ()
This event is triggered when the client tries to establish a connection with the server. Generally, it is used in distributed applications and can only be triggered in applications on the server side.

◆ Connectionend ()
When the client application ends, this event can only be triggered on the server of the distributed application.


[Function]

★Classname ()
Returns the name of the Application object.

★Getcontextservice ()
Creates a reference for the service specified by the context-sensitive instance.

★Getparent ()
Returns the reference of the parent object of the specified object name.

★Postevent ()
Add a message about the event to be triggered at the end of the message queue of the Application object.

★Setlibraylist ()
Set the library list of PBD during execution. The application object is unique and used to change the dynamic library file list in the library search path. This function is only valid when running outside the Pb development environment, the setlibraylist () function accepts a comma-separated list of file names and searches for objects in the specified list order.

★Settranspool ()
Sets the transaction object buffer pool for a database object.

★Triggerevent ()
Trigger the specified event in the Application object. If the event has a script, execute the script under the event.

★Typeof ()
Returns the enumerated type of the application.


//////////////////////////////////
INI file Composition
[Section]
Keyword = Value
* If the value is null, the default value is used.

////
[Database]
DBMS = "MSS Microsoft SQL Server 6.x"
Database = "nlerp"
Servername = "CWD"
[Application]
Title = Foreign Trade Management System
////

Read
String ls_logid
Ls_logid = profilestring ("D. ini", 'database', 'logid', 'sa ')
Default Value of the byte keyword of the INI file name that saves the value

Profilestring (filename, section, key, default)
Profilestring ("C: \ profile. ini", "employee", "name", "NONE ")

Profileint

Set
Setprofilestring

//////////////////////////////////

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.