| Hyderabad Jobs | Book Website | ![]() |
I Love Hyderabad | Hyderabad Colleges |
| Home | Business Emails | Hyderabad Classifieds | Contact Us | |
| 7 Wonders of Hyderabad | Web Hosting | Yellow Pages | Our Network | |
Introduction to PowerBuilder
Cascaded Events and FunctionsThe event/function syntax allows you to make nested event/function calls. The return value of the first event/function must be an object and it becomes the object upon which the second event/function acts. // instance variables
// int ii_hours
// String ii_YarnType
NonVisualObject lnc_object
nc_MachineObject lnc_MachObj
Long li_Prod
lnc_MachObj = Create nc_MachineObject
lnc_object = lnc_MachObj.Function Trigger &
Dynamic of_GetObject ( ii_no )
If NOT IsValid( lnc_object ) Then Return -100
li_Prod =.lnc_Object.Function Trigger Dynamic of_GetProd &
( ii_hours, ii_YarnType )
If li_Prod = 0 Then
// Error handling
End If
Destroy lnc_MachObj
The above example calculates production for different type of machines; machine from different vendors and of different makes have different formulas for production calculation. Function call of_GetObject() at custom class object nc_MachineObject returns appropriate custom class object depending on the vendor and the make of the machine. The second function of_GetProd() returns production for that machine depending on the number of hours that machine ran and the type of the product. // instance variables
// int ii_hours
// String ii_YarnType
nc_MachineObject lnc_MachObj
Long li_Prod
lnc_MachObj = Create nc_MachineObject
li_Prod = lnc_MachObj.Function Trigger Dynamic of_GetObject &
( ii_no ).of_GetProd( ii_hours, ii_YarnType )
If li_Prod = 0 Then
// Error handling
End If
Destroy lnc_MachObj
The above code does the same thing as the earlier code listing, using nested function calls. As you can see here, you can't check if the returned object is a valid object or not. Make sure to check for valid objects and for error handling in the called objects. If you use DYNAMIC keyword for the first event/function from left, it would apply for all nested event/function calls. Another suggestion would be that if you want to post event/function calls, do it only at the last event/function call.
|
| Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com |