My guess is that the oMapUnit object reference is going out of scope at the end of the Click event, so the object is released.
If you put a breakpoint after the
.visible = .T.
, do you see it?
Are you trying to add this to the form? If so, use the form.NewObject() method instead of the NewObject() function. e.g.
thisform.NewObject("oMapUnit", "sitemapunit", "umbrlib.vcx")
WITH thisform.oMapUnit
.top = 250
.left = 250
.visible = .T.
.Refresh()
ENDWITH
thisform.refresh
>Hello,
>
>I'm having a problem with the NewObject() function. From the help files I'm pretty sure I've got it right but when I run my code segment that is supposed to create a container object from a custom .vcx file nothing appears.
>
>My first question: Is there a way to test to make sure an object was created?
>
>Second question: Here is my code segment. The code exists in the Click Event of a command button
>
>`````````````````````````````````````````````````````````
>oMapUnit = NewObject("sitemapunit", "umbrlib.vcx")
>
>WITH oMapUnit
> .top = 250
> .left = 250
> .visible = .T.
>ENDWITH
>
>oMapUnit.refresh
>thisform.refresh
>`````````````````````````````````````````````````````````
>
>Now umbrlib.vcx is included in my build and I don't get any errors when this code is ran.
>
>In the help files for addobject() it says the object is at first created with visible = .F. so I added .visible = .T. just in case. Yet I still do not see anything.
>
>Any help is appreciated.. I just want to see my new object *grin*
>
>Thanks,
>Bryan
Insanity: Doing the same thing over and over and expecting different results.