J
Jack Leach
Hi, thanks in advance for any insight...
I'm trying to run Stephens Month Calendar from a standard module rather than
a form in an effort to globalize many redundant procedures behind my forms.
The function itself passes the control, and verifies that the user wants to
replace a date if there's already one picked. No biggie.
My question is how to go about making sure that the class closes correctly.
As setup per his instructions in a Form's module, the Load event sets the
private mc, and the Unload event checks the IsCalendar property of the class
and either closes or cancels the unload accordingly. I'm not quite sure how
to capture this from a standard module procedure (or if I should be screwing
with this at all really).
Here's a skeleton of the procedure:
Public Function SetDate(ctl As Control, lWnd As Long)
Dim mc As New clsMonthCal
mc.hWndForm = lWnd
...
...
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
...
...
Exit_Proc:
Set mc = Nothing
Exit Function
Error_Proc:
...
Resume Exit_Proc
End Function
The Set mc = Nothing line runs the Class_Terminate method of clsMonthCal,
which I assume is suffient to clean things up under normal circumstances
(there is no explicit closing of the class in the Form module setup other
than setting it Nothing in the Unload event).
Being that this class opens the calendar as system modal, I think the only
way to close the db without closing the calendar would be a power
interruption or task manager shutdown.
Any idea's on how I can trap the IsCalendar property and suspend the code if
it is true? Even in the original form module instructions, there doesn't
seem to be any method to handle things if IsCalendar is true... it just exits
the sub. Based on my experiment stepping through the code behind his class
(yes, it wall crash your machine), it seems that there's no way to get ANY
other code to run while that calendar is open.
So far everything seems to be working fine, with the exception of handling
this unclean closing... any ideas would be great.
Thanks!
--
Jack Leach
www.tristatemachine.com
"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
I'm trying to run Stephens Month Calendar from a standard module rather than
a form in an effort to globalize many redundant procedures behind my forms.
The function itself passes the control, and verifies that the user wants to
replace a date if there's already one picked. No biggie.
My question is how to go about making sure that the class closes correctly.
As setup per his instructions in a Form's module, the Load event sets the
private mc, and the Unload event checks the IsCalendar property of the class
and either closes or cancels the unload accordingly. I'm not quite sure how
to capture this from a standard module procedure (or if I should be screwing
with this at all really).
Here's a skeleton of the procedure:
Public Function SetDate(ctl As Control, lWnd As Long)
Dim mc As New clsMonthCal
mc.hWndForm = lWnd
...
...
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
...
...
Exit_Proc:
Set mc = Nothing
Exit Function
Error_Proc:
...
Resume Exit_Proc
End Function
The Set mc = Nothing line runs the Class_Terminate method of clsMonthCal,
which I assume is suffient to clean things up under normal circumstances
(there is no explicit closing of the class in the Form module setup other
than setting it Nothing in the Unload event).
Being that this class opens the calendar as system modal, I think the only
way to close the db without closing the calendar would be a power
interruption or task manager shutdown.
Any idea's on how I can trap the IsCalendar property and suspend the code if
it is true? Even in the original form module instructions, there doesn't
seem to be any method to handle things if IsCalendar is true... it just exits
the sub. Based on my experiment stepping through the code behind his class
(yes, it wall crash your machine), it seems that there's no way to get ANY
other code to run while that calendar is open.
So far everything seems to be working fine, with the exception of handling
this unclean closing... any ideas would be great.
Thanks!
--
Jack Leach
www.tristatemachine.com
"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)