Author | Topic: Typkonflikt | |
---|---|---|
AUGE_OHR | Typkonflikt on Fri, 30 Jan 2009 23:31:27 +0100 hi, im fighting with CodeJock Calender Resources, but i allways got a "Typkonflikt". *** snip Code *** oTest := CalendarControl:MultipleResources() "ICalendarResources" nCount := oTest:Count() IF nCount > 0 CalendarControl:SetMultipleResources( oTest ) WORKS ENDIF "ICalendarResources" arResources := CreateObject( "Codejock.CalendarResources.12.1.1" ) arResources:Add( pRes0 ) pRes0 is a "ICalendarResource" arResources:Add( pRes1 ) pRes1 is a "ICalendarResource" nCount := arResources:Count() IF nCount > 0 CalendarControl:SetMultipleResources( arResources ) -> CRASH ENDIF **************** oError:args : -> VALTYPE: C VALUE: SetMultipleResources -> VALTYPE: O CLASS: AutomationObject oError:canDefault : J oError:canRetry : N oError:canSubstitute: J oError:cargo : NIL oError:description : Falscher Parameter. oError:filename : NIL oError:genCode : NIL oError:operation : SetMultipleResources oError:osCode : -2147024809 oError:severity : 2 oError:subCode : 6500 oError:subSystem : Automation oError:thread : 1 oError:tries : NIL *** eof *** oTest and arResources both are from "ICalendarResources" and nCount is > 0 why does it only crash at 2nd. time ? greetings by OHR Jimmy | |
AUGE_OHR | Re: Typkonflikt on Sat, 31 Jan 2009 01:08:08 +0100 ok here is a other Sample with ApplyToCalendar() Crash ... this is the original Thread https://forum.codejock.com/forum_posts.asp?TID=7473&KW=SetMultipleResources&PID=24068#24068 and this is my Xbase+++ Code *** snip Code*** METHOD NewForm:OpenRes() LOCAL CalendarControl := ::oCalCon LOCAL ViewDay LOCAL arResources LOCAL pRes0 LOCAL pRes1 LOCAL pSchedules LOCAL bResult := .F. LOCAL cConnectionString LOCAL g_DataResourcesMan LOCAL nCount g_DataResourcesMan := CreateObject( "Codejock.CalendarResourcesManager.12.1.1" ) * g_DataResourcesMan:RemoveAll() arResources := CreateObject( "Codejock.CalendarResources.12.1.1" ) pRes0 := CreateObject( "Codejock.CalendarResource.12.1.1" ) pRes1 := CreateObject( "Codejock.CalendarResource.12.1.1" ) ************************************************************************** 1st DataProvider * ************************************************************************** strConnectionString = _ * "Provider=Microsoft.Jet.OLEDB.4.0;" & _ * "Data Source=" & App.Path & "\Events1.mdb" & ";" & _ * "Jet OLEDB:Encrypt Database=True;" bResult = g_DataResourcesMan.AddDataProvider( _ * strConnectionString, xtpCalendarDPF_CreateIfNotExists + _ * xtpCalendarDPF_SaveOnDestroy + xtpCalendarDPF_CloseOnDestroy) pRes0.SetDataProvider g_DataResourcesMan.DataProvider(0), True If pRes0.DataProvider Is Nothing Then * Debug.Assert False Exit Sub End If * If Not pRes0.DataProvider.Open Then * If Not pRes0.DataProvider.Create Then * Debug.Assert False Exit Sub End If * End If cConnectionString := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Events1.mdb;Jet OLEDB:Encrypt Database=True;" bResult := g_DataResourcesMan:AddDataProvider(cConnectionString ,; xtpCalendarDPF_CreateIfNotExists +; xtpCalendarDPF_SaveOnDestroy +; xtpCalendarDPF_CloseOnDestroy ) pRes0:SetDataProvider( g_DataResourcesMan:DataProvider(0), True) IF pRes0:DataProvider = NIL RETURN .F. ENDIF IF .NOT. pRes0:DataProvider:Open() IF .NOT. pRes0:DataProvider:Create() RETURN .F. ENDIF ENDIF ************************************************************************** 2nd DataProvider * ************************************************************************** * strConnectionString = _ * "Provider=Microsoft.Jet.OLEDB.4.0;" & _ * "Data Source=" & App.Path & "\Events2.mdb" & ";" & _ * "Jet OLEDB:Encrypt Database=True;" bResult = g_DataResourcesMan.AddDataProvider( _ * strConnectionString, xtpCalendarDPF_CreateIfNotExists + _ * xtpCalendarDPF_SaveOnDestroy + xtpCalendarDPF_CloseOnDestroy) pRes1.SetDataProvider g_DataResourcesMan.DataProvider(1), True If pRes1.DataProvider Is Nothing Then * Debug.Assert False Exit Sub End If If Not pRes1.DataProvider.Open Then * If Not pRes1.DataProvider.Create Then * Debug.Assert False Exit Sub End If End If cConnectionString := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Events2.mdb;Jet OLEDB:Encrypt Database=True;" bResult := g_DataResourcesMan:AddDataProvider(cConnectionString ,; xtpCalendarDPF_CreateIfNotExists +; xtpCalendarDPF_SaveOnDestroy +; xtpCalendarDPF_CloseOnDestroy ) pRes1:SetDataProvider( g_DataResourcesMan:DataProvider(1), True) IF pRes1:DataProvider = NIL RETURN .F. ENDIF IF .NOT. pRes1:DataProvider:Open() IF .NOT. pRes1:DataProvider:Create() RETURN .F. ENDIF ENDIF ************************************************************************** Schedules * ************************************************************************** * Set pSchedules = pRes0.DataProvider.Schedules * pRes0.Name = pSchedules.Item(0).Name * pRes0.ScheduleIDs.Add pSchedules.Item(0).Id Set pSchedules = pRes1.DataProvider.Schedules * pRes1.Name = pSchedules.Item(0).Name * pRes1.ScheduleIDs.Add pSchedules.Item(0).Id arResources.Add pRes0 * arResources.Add pRes1 g_DataResourcesMan.ApplyToCalendar CalendarControl CalendarControl.SetMultipleResources arResources CalendarControl.Populate * CalendarControl.RedrawControl pSchedules := pRes0:DataProvider:Schedules() IF pSchedules = NIL RETURN .F. ENDIF nCount := pSchedules:Count() IF nCount < 1 pSchedules:AddNewSchedule( "John" ) pRes0:DataProvider:Save() ENDIF pRes0:Name := pSchedules:Item(0):Name pRes0:ScheduleIDs:Add( pSchedules:Item(0):Id ) pSchedules := pRes1:DataProvider:Schedules() nCount := pSchedules:Count() IF nCount < 1 pSchedules:AddNewSchedule( "Jane" ) pRes1:DataProvider:Save() ENDIF pRes1:Name := pSchedules:Item(0):Name pRes1:ScheduleIDs:Add( pSchedules:Item(0):Id ) arResources:Add( pRes0 ) arResources:Add( pRes1 ) next Step both crash g_DataResourcesMan:ApplyToCalendar( CalendarControl ) CalendarControl:SetMultipleResources := arResources CalendarControl:Populate() CalendarControl:RedrawControl() RETURN self *** eof *** greetings by OHR Jimmy |