Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with calendar control (OLE)

Status
Not open for further replies.

mpgalvin

Programmer
Feb 5, 2001
119
IE
I have a Calendar control on my form which is invisible to begin with. On the MouseDown event of a combo box, I'm bringing up the control, and allowing the user to dbl click on a date, causing the control to disappear.

This all works like a charm, but after bringing up the control, I can no longer RELEASE the form. I have to CANCEL and CLEAR ALL before I can get rid of it. It only happens after the calendar has been made visible - I can exit at any time before that.

I can't see anything strange about the control (I've used it dozens of times) but I assume it's the one causing the problem. Anyone encountered this (the calendar control is on a different 'level' to the control that is calling it, if that helps, which it probably doesn't)
 
I'm sure that what is happening is that a reference to the form is being created by the calender object which isn't being dropped when it is , so that the system won't let the form be released since there's still a reference to it. I wish I wasn't such a neophyte and could tell you just how to debug it, but all I can suggest is to set some sort of assert and pull up debugger after the calender control goes away and see what the references to the form are (how you do this is what I don't know offhand). --Dave
 
That's possible, Dave. I'm using an object variable so that the results of the calendar.doubleclick are sent back to the right place. I know I'm not 'releasing' that variable, but I wouldn't have thought it necessary...
 
Hi my friend
Again using the ActiveX control without being able to fully control it is not a good idea. You may consider warp it with your own class. Read my response to thread184-77132 for an idea [from many] of how to do it.
Good luck to you
Walid Magd
Engwam@Hotmail.com
 
Walid, I'm not really sure what you're talking about! Which control am I not "able to fully control"? The thread you point to is about modal and modeless forms?! No, I'm lost.

However, it turns out that Dave was right - I had to release the object variable. Now I have a new problem with the same control (so I thought I'd put it in here, see if I get any responses).

When the control is made visible, I'm setting its position like so:

Code:
with this.parent.calendar
     .left   = 236
     .top    = 107
     .height = 156
     .width  = 283
endwith

However, when I run the form, only the height and width properties are set - top and left are as they are in form-design. And I have no idea why!

It's not a major problem, because I can just put the calendar control exactly where I want it to appear in design-mode, but it'd be nice to know if it's me...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top