Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/Calendar/Calendar Test
Required plugins for this example: MBS MacBase Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/Calendar/Calendar Test
This example is the version from Sun, 17th Mar 2012.
Project "Calendar Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
if TargetMachO then
else
MsgBox "This application requires Mac OS X 10.5."
quit
end if
End EventHandler
End Class
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control ListBox2 Inherits ListBox
ControlInstance ListBox2 Inherits ListBox
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control ListBox3 Inherits ListBox
ControlInstance ListBox3 Inherits ListBox
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control ListBox4 Inherits ListBox
ControlInstance ListBox4 Inherits ListBox
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
EventHandler Sub Open()
c=new MyCalCalendarStoreMBS
dim calendars(-1) as CalCalendarMBS = c.calendars
for each cc as CalCalendarMBS in calendars
ListBox1.AddRow cc.Title
Listbox1.Cell(listbox1.LastIndex,1)=cc.type
next
dim sd,ed as date
sd=new date
sd.Hour=0
sd.Minute=0
sd.Second=0
ed=new date
ed.Hour=0
ed.Minute=0
ed.Second=0
ed.day=ed.day+1
dim events() as CalEventMBS = c.events(sd,ed,calendars)
for each ce as CalEventMBS in events
ListBox2.AddRow ce.Title
Listbox2.Cell(listbox2.LastIndex,1)=ce.startDate.ShortTime
Listbox2.Cell(listbox2.LastIndex,2)=ce.endDate.ShortTime
next
dim dd as date
dim tasks() as CalTaskMBS = c.UncompletedTasks(calendars)
for each ct as CalTaskMBS in tasks
ListBox3.AddRow ct.Title
dd=ct.dueDate
if dd=nil then
Listbox3.Cell(listbox3.LastIndex,1)="-"
else
Listbox3.Cell(listbox3.LastIndex,1)=dd.ShortDate+" "+dd.ShortTime
end if
Listbox3.Cell(listbox3.LastIndex,2)=str(ct.priority)
next
Exception ex as NSExceptionMBS
MsgBox ex.message
End EventHandler
Property c As myCalCalendarStoreMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyCalCalendarStoreMBS Inherits CalCalendarStoreMBS
EventHandler Sub CalendarsChanged(Externally as boolean, InsertedRecords() as string, UpdatedRecords() as string, DeletedRecords() as string)
window1.ListBox4.AddRow "Calendars"
dim s() as string
for each id as string in InsertedRecords
s.Append "insert "+id
next
for each id as string in UpdatedRecords
s.Append "update "+id
next
for each id as string in DeletedRecords
s.Append "delete "+id
next
if UBound(s)=-1 then
window1.ListBox4.Cell(window1.ListBox4.LastIndex,1)="all changed"
else
window1.ListBox4.Cell(window1.ListBox4.LastIndex,1)=Join(s,", ")
end if
End EventHandler
EventHandler Sub EventsChanged(Externally as boolean, InsertedRecords() as string, UpdatedRecords() as string, DeletedRecords() as string)
window1.ListBox4.AddRow "Events"
End EventHandler
EventHandler Sub TasksChanged(Externally as boolean, InsertedRecords() as string, UpdatedRecords() as string, DeletedRecords() as string)
window1.ListBox4.AddRow "Tasks"
End EventHandler
End Class
End Project
See also:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.