Update Chartdirector chart

I’m trying to modify the MBS Chartdirector squareameter so it doesn’t draw a new chart every time I update the value to be displayed. I’m probably missing something very basic. The demo uses a method called CreateChart that starts with:

dim w as new PicWindow

This method creates a new window with each call, so I have been trying to figure out how to make w public, so it only needs to be created once, and I can than change what it displays, rather than create a new window every time.

The code does not recognize w when I make it a public property with type PicWindow in App. The code stops at the first call to a w property with a nil object exception.

Post your code?

if w would be a property of app, you could check if it is nil.
If nil, create a new window. Than set w property.
if not nil, reuse window.

Thanks Christian. I had been assuming that PicWindow in the demo was particular to Chartdirector. When I realized it was just a standard window, all fell into place. I just removed the property w and all references to it, and moved the method CreateChart into PicWindow.