Skip to Content
0

Instantiating an object on a window.

Apr 08 at 05:28 PM

49

avatar image

I am a little rusty so I am having trouble drawing on a window...

I can create a window, and I can create a rectangle on that window via the painter. When I run the application, the window shows and the rectangle shows. I can then manipulate the rectangle almost any way I want.

However, If I try to create the rectangle via code (l_rect = CREATE RECTANGLE), then set it's coordinates on the window, and make it visible, I never see the rectangle.

What step(s) am I missing that would make the rectangle usable?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
René Ullrich Apr 09 at 05:57 AM
0

If you create instances of visible controls using CREATE the instance will not be visible on your window.

To create visible controls on a window you have to use the OpenUserObject or OpenUserObjectWithParm. But you can only create DragObjects using this functions. Rectangles are DrawObjects.

Workarounds:

- Put at design time a rectangle on a userobject. You cat open the userobject at runtime dynamically using OpenUserObject.

- Use a groupbox instead of the rectangle. You ca create groupboxes dynamically using OpenUserObject.

- Use a datawindow control an datawindows. In datawindows it is possible to create rectangles at runtime.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks, I thought this was the case (That Create would not work on the window. For now, I am creating them invisible in the painter during design and then making them visible at run time.

I will look into your suggestions and see if any are usable in my application.

Thanks again.

0