10.3 descendants of the object changes
Inherit the window is not our purpose ancestors. The purpose of using the inheritance feature is more similar to some common characteristics of the object defined in the ancestor of the object which then passed to future generations inherit the ancestor object access to these common characteristics of the object, after the completion of the work of succession, there is another important task is through modify these objects so that they were descendants of its own unique features to complete the task of future generations of the object itself.
Let's look at an example to illustrate how to implement such changes. First, open a window offspring. Now the window and the window is exactly the same ancestors. Figure 10-6.
Figure 10-6
Ancestors of the window function is to display the database among all the sports stars of the information, we want to modify future generations window, so that the data show only football star.
Select the static text object, right-click on it, pop-up menu, select PROPERTIES command, to modify the content of TEXT column as a "football star." We do not want to delete the button. Figure 10-7.
Figure 10-7
If you want to modify the properties have been ancestors of the window to reset the contents of the menu as long as the choice among the RESET PROPERTIES ED99v reset the Properties command on it. In the data window object we can modify the data window below the script, so that it has new features.
Figure 10-8
In the data window above the right-click, pop-up menu, choose the SCRIPT command, open the script work area, we have seen, when the content of the work area is empty. Figure 10-8.
Figure 10-9
Click SELECT EVENT event selection list box, select the events need to write the script. You can see a list of all events, a small icon on the left is the ancestor event script object which already exists. Figure 10-9.
Select CLICKED click event.
Figure 10-10
At this time, the work area which is still empty, if you want to show the ancestors of the script, you can select the DESIGN menu DISPLAY ANCESTOR SCRIPT show ancestor script command, which could pop up a dialog box, which shows the ancestors of the script, get some tips. Figure 10-10.
Close this dialog box. Scripts and future generations deal with the relationship between the ancestors of the script in two ways, one is overloaded ancestor script, that is to rewrite a script, so replace the ancestors of the corresponding script. For example, here we enter a script:
STRING SYNTAX, SQLSTR, ERRMSG
SQLSTR = "SELECT SOCCER.NAME, SOCCER.AGE, SOCCER.CLUB, SOCCER.NATION" &
+ "FROM SOCCER"
CONNECT USING SQLCA;
SYNTAX = SQLCA.SYNTAXFROMSQL (SQLSTR, "STYLE (TYPE = GRID)", ERRMSG)
dw_1.CREATE (SYNTAX, ERRMSG)
dw_1.Modify ("name.Width = 390")
dw_1.Modify ("age.Width = 140")
dw_1.Modify ("club.Width = 400")
dw_1.Modify ("nation.Width = 260")
dw_1.SetTransObject (SQLCA)
dw_1.RETRIEVE ()
DESIGN window and then choose among the ancestors of the script override OVERRIDE ANCESTOR SCRIPT command on it.
Another is the expansion of ancestral script, which means an increase in the ancestor script based on a script, so that the program is running, the first call to the ancestors of the script, and then the increase in the implementation of our script. If you want to use this approach, you need written script in the following menu choices DESIGN EXTEND ANCESTOR SCRIPT among the ancestors of the script command extension.
Among the POWER BUILDER, can have multi-level inheritance, that is a descendant of an object can have his father, grandfather, or a higher level ancestors. Objects in the script for future generations, we can call any ancestor object which has been written script. For example, call the parent object among CLICKED click event write the script, you can enter the following code like this.
CALL SUPER:: Clicked
Note that this time must be specified SUPER words. The call to a higher level when the ancestors of the script object must be marked ancestor's name, like this:
W_ANCESTOR:: Clicked
We can also call for the ancestors of future generations of objects which included a control object or the object of the event script, for example, the meaning of this script is called the ancestor of the object of a function:
W_ANCESTOR:: Fuction
Understand the content, you master the basic features of the POWER BUILDER inheritance.
Recommended links:
Simple Automation Tools
YUV To AVI
Blog: Beware Of The Computer In The City's "hidden Rules"
Optic Bound Former President Of EA Games Live On Their Own Exclusive Rights To Operate
Chen Zhou reflect years of business success: The greatest scar has not come yet
how to beat THE roulette wheel. try this system
MPEG to MOV
MODELING with UML to note problems
Lead time and queuing time
REVIEW Religion
DV To AVI
Pause slideshow tips
Understanding of the Process of DB2 Universal Database (2)
No comments:
Post a Comment