Skip to Content

Instantiating an object on a window.

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 09 at 05:57 AM

    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.

    Add comment
    10|10000 characters needed 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.