Pages

Thursday, April 28, 2011

Create Object Programmatically with Powerbuilder - Part 1

In Powerbuilder, we can create an object programmatically, means that you can create whenever you need or conditionally.

In this first part, I trying to explain how to create "static" picture object when user clicking the button. Static mean that we only create the object, without script associated inside the object. The function that will be used it's called: openuserobject


For detail explanation of openuserobject function, please see the official help of Powerbuilder. 

First, create a button, and type this follow script inside Clicked event.
1:  picture p_2 // declare the picture variable  
2:  p_2 = create picture // create the picture object  
3:    
4:  p_2.x = 100 // x position of the object  
5:  p_2.y = 100 // y position of the object  
6:  p_2.height = 250 // height value of the object  
7:  p_2.width = 250 // with value of the object  
8:  p_2.picturename = "redalert.bmp" // name of the picture inc full path  
9:    
10:  parent.openuserobject( p_2, "p_2", 100, 100) // ok, let's create the object  


No comments:

Post a Comment