Click to See Complete Forum and Search --> : ActiveX control properties


sfought
April 9th, 1999, 12:23 AM
I have created an OCX, and it has some custom properties, ie left, top, width, height. When I add the ocx to a project, I can access the properties by right clicking on the control, but I cannot access them in the code.

myocx.left

Gives me an error saying that left is not a member of myocx. I can access the properties by calling myocx.GetLeft and myocx.SetLeft, but I would like to be able to just use the property name. Any help you could give would be greatly appreciated.

Thanks,
sfought

ric
April 9th, 1999, 04:44 AM
I very often come upon such errors. They come mostly from misspelling. If you have generaed you class with the Class Wizzard probably all the names starts with m_ (like m_left). Or check if you have declared your member vars in some improper place. Try this out, it worked for me several times:

find a nice clean WHITE space in the declaration of your class and write:

public:
int m_left;
....

be sure your vars appear in BLACK

April 9th, 1999, 05:43 AM
I don't think you're supposed to have access to the properties. Most often they are declared private or protected with public access functions such as
get_Property, set_Property. This is one part of object orientation. Simple, just use the get/set operations....

/Rob