Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Visual Control at runtime

Status
Not open for further replies.

Negator

Programmer
Oct 4, 2003
33
RU
Hello all PowerBuilder wizards!

I'm using PW8 in Win2000.
My question is: how to create some control (for example, CommandButton) on the window at runtime. I tried like this:

commandbutton b1
OpenUserObject(b1, 100, 100)

I am able to interact with b1's properties, but the control is still invisible! I'll be very pleasant if you'll help me!

Thank you!

Alexey.
 
Negator,

Try creating a standard-visual user-object out of the CommandButton, save it as a user-object and then open it on the window.

When you open a user object during execution, the window does not destroy the user object automatically when you close the window. You need to call CloseUserObject to destroy the user object, usually when the window closes. If you don't destroy the user object, it holds on to its allocated memory, resulting in a memory leak.

PowerBuilder displays the user object when it next updates the display or at the end of the script, whichever comes first. For example, if you open several user objects in a script, they will all display at once when the script is complete, unless some other statements cause a change it the screen's appearance (for example, the MessageBox function displays a message or the script changes a visual property of a control or a call to SetRedraw( TRUE ) function).

Calling OpenUserObject twice If you call Syntax 1 twice to open the same user object, PowerBuilder activates the user object twice; it does not open two instances of the user object.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top