TvPlanIt: Deletion of a resource deletes also the associated events, contacts and tasks. Tested with all database datastores. Update datastore sample projects.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8947 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-10 22:24:46 +00:00
parent f54a1641df
commit f0d8344fee
19 changed files with 611 additions and 692 deletions

View File

@ -6,25 +6,27 @@ object Form1: TForm1
Caption = 'VpFlexDatastore demo (MS Access via ODBC)'
ClientHeight = 686
ClientWidth = 980
LCLVersion = '3.99.0.0'
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '2.3.0.0'
object Panel1: TPanel
Left = 0
Height = 33
Height = 34
Top = 0
Width = 980
Align = alTop
AutoSize = True
BevelOuter = bvNone
ClientHeight = 33
ClientHeight = 34
ClientWidth = 980
TabOrder = 0
object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4
Height = 23
Top = 5
Top = 6
Width = 208
DataStore = VpFlexDataStore1
Style = csDropDownList
@ -35,38 +37,59 @@ object Form1: TForm1
object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 216
Height = 25
Top = 4
Top = 5
Width = 98
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1
OnClick = BtnNewResClick
end
object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 318
Height = 25
Top = 4
Top = 5
Width = 94
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end
end
object PageControl1: TPageControl
Left = 0
Height = 653
Top = 33
Height = 652
Top = 34
Width = 980
ActivePage = TabSheet1
Align = alClient
@ -75,23 +98,18 @@ object Form1: TForm1
OnChange = PageControl1Change
object TabSheet1: TTabSheet
Caption = 'Events and tasks'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 972
object VpDayView1: TVpDayView
Left = 0
Height = 625
Height = 624
Top = 0
Width = 301
PopupMenu = VpDayView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True
ShowEventTimes = False
DrawingStyle = dsFlat
@ -102,81 +120,56 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end
object Panel2: TPanel
Left = 306
Height = 625
Height = 624
Top = 0
Width = 386
Align = alLeft
BevelOuter = bvNone
Caption = 'Panel2'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 386
TabOrder = 1
object VpWeekView1: TVpWeekView
Left = 0
Height = 379
Height = 378
Top = 0
Width = 386
PopupMenu = VpWeekView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday
Align = alClient
TabStop = True
TabOrder = 0
end
object VpMonthView1: TVpMonthView
Left = 0
Height = 241
Top = 384
Top = 383
Width = 386
PopupMenu = VpMonthView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alBottom
TabStop = True
TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3
@ -186,7 +179,7 @@ object Form1: TForm1
Cursor = crVSplit
Left = 0
Height = 5
Top = 379
Top = 378
Width = 386
Align = alBottom
ResizeAnchor = akBottom
@ -194,52 +187,40 @@ object Form1: TForm1
end
object VpTaskList1: TVpTaskList
Left = 697
Height = 625
Height = 624
Top = 0
Width = 275
PopupMenu = VpTaskList1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
TabStop = True
TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = True
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat
ShowResourceName = True
LineColor = clGray
TaskHeadAttributes.Color = clSilver
end
object Splitter1: TSplitter
Left = 692
Height = 625
Height = 624
Top = 0
Width = 5
end
object Splitter3: TSplitter
Left = 301
Height = 625
Height = 624
Top = 0
Width = 5
end
end
object TabSheet2: TTabSheet
Caption = 'Contacts'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 972
object VpContactButtonBar1: TVpContactButtonBar
Left = 0
Height = 625
Height = 624
Top = 0
Width = 40
DrawingStyle = dsFlat
@ -248,27 +229,21 @@ object Form1: TForm1
end
object VpContactGrid1: TVpContactGrid
Left = 40
Height = 625
Height = 624
Top = 0
Width = 932
PopupMenu = VpContactGrid1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
TabStop = True
TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat
end
end
object TabSheet3: TTabSheet
Caption = 'Grids'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 972
object TabControl1: TTabControl
AnchorSideLeft.Control = TabSheet3
@ -279,7 +254,7 @@ object Form1: TForm1
AnchorSideBottom.Control = TabSheet3
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 576
Height = 575
Top = 41
Width = 956
OnChange = TabControl1Change
@ -295,7 +270,7 @@ object Form1: TForm1
TabOrder = 0
object Grid: TDBGrid
Left = 2
Height = 551
Height = 550
Top = 23
Width = 952
Align = alClient
@ -338,8 +313,8 @@ object Form1: TForm1
Width = 120
BorderSpacing.Left = 8
Caption = 'Apply to planner'
OnClick = BtnApplyToPlannerClick
TabOrder = 2
OnClick = BtnApplyToPlannerClick
end
end
end
@ -354,7 +329,7 @@ object Form1: TForm1
Top = 168
end
object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12'
Version = 'v1.8.0'
DataStore = VpFlexDataStore1
Options = []
Placement.Position = mpCenter
@ -366,38 +341,22 @@ object Form1: TForm1
Top = 232
end
object VpFlexDataStore1: TVpFlexDataStore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoConnect = False
AutoCreate = True
DayBuffer = 31
DataSources.ResourceDataSource = DsResources
DataSources.EventsDataSource = DsEvents
DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks
ResourceID = 0
OnCreateTable = VpFlexDataStore1CreateTable
Left = 136
Top = 101

View File

@ -19,6 +19,7 @@ type
{ TForm1 }
TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton;
BtnEditRes: TButton;
BtnApplyToPlanner: TButton;
@ -62,6 +63,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject);
procedure BtnApplyToPlannerClick(Sender: TObject);
@ -118,6 +120,22 @@ begin
VpResourceEditDialog1.Execute;
end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
procedure TForm1.BtnApplyToPlannerClick(Sender: TObject);
var
resID: Integer;

View File

@ -6,25 +6,27 @@ object Form1: TForm1
Caption = 'Form1'
ClientHeight = 686
ClientWidth = 910
LCLVersion = '3.99.0.0'
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '2.3.0.0'
object Panel1: TPanel
Left = 0
Height = 33
Height = 34
Top = 0
Width = 910
Align = alTop
AutoSize = True
BevelOuter = bvNone
ClientHeight = 33
ClientHeight = 34
ClientWidth = 910
TabOrder = 0
object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4
Height = 23
Top = 5
Top = 6
Width = 208
DataStore = VpFlexDataStore1
Style = csDropDownList
@ -35,6 +37,7 @@ object Form1: TForm1
object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 216
Height = 25
Top = 4
@ -44,12 +47,13 @@ object Form1: TForm1
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1
OnClick = BtnNewResClick
end
object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 318
Height = 25
Top = 4
@ -59,14 +63,31 @@ object Form1: TForm1
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end
end
object PageControl1: TPageControl
Left = 0
Height = 653
Top = 33
Height = 652
Top = 34
Width = 910
ActivePage = TabSheet1
Align = alClient
@ -74,23 +95,18 @@ object Form1: TForm1
TabOrder = 1
object TabSheet1: TTabSheet
Caption = 'Events and tasks'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 902
object VpDayView1: TVpDayView
Left = 0
Height = 625
Height = 624
Top = 0
Width = 283
PopupMenu = VpDayView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True
ShowEventTimes = False
DrawingStyle = dsFlat
@ -101,81 +117,56 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end
object Panel2: TPanel
Left = 288
Height = 625
Height = 624
Top = 0
Width = 363
Align = alLeft
BevelOuter = bvNone
Caption = 'Panel2'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 363
TabOrder = 1
object VpWeekView1: TVpWeekView
Left = 0
Height = 379
Height = 378
Top = 0
Width = 363
PopupMenu = VpWeekView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday
Align = alClient
TabStop = True
TabOrder = 0
end
object VpMonthView1: TVpMonthView
Left = 0
Height = 241
Top = 384
Top = 383
Width = 363
PopupMenu = VpMonthView1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alBottom
TabStop = True
TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3
@ -185,7 +176,7 @@ object Form1: TForm1
Cursor = crVSplit
Left = 0
Height = 5
Top = 379
Top = 378
Width = 363
Align = alBottom
ResizeAnchor = akBottom
@ -193,52 +184,40 @@ object Form1: TForm1
end
object VpTaskList1: TVpTaskList
Left = 656
Height = 625
Height = 624
Top = 0
Width = 246
PopupMenu = VpTaskList1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
TabStop = True
TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = True
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat
ShowResourceName = True
LineColor = clGray
TaskHeadAttributes.Color = clSilver
end
object Splitter1: TSplitter
Left = 651
Height = 625
Height = 624
Top = 0
Width = 5
end
object Splitter3: TSplitter
Left = 283
Height = 625
Height = 624
Top = 0
Width = 5
end
end
object TabSheet2: TTabSheet
Caption = 'Contacts'
ClientHeight = 625
ClientHeight = 624
ClientWidth = 902
object VpContactButtonBar1: TVpContactButtonBar
Left = 0
Height = 625
Height = 624
Top = 0
Width = 40
DrawingStyle = dsFlat
@ -247,21 +226,15 @@ object Form1: TForm1
end
object VpContactGrid1: TVpContactGrid
Left = 40
Height = 625
Height = 624
Top = 0
Width = 862
PopupMenu = VpContactGrid1.default
DataStore = VpFlexDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
TabStop = True
TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat
end
end
@ -277,7 +250,7 @@ object Form1: TForm1
Top = 168
end
object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12'
Version = 'v1.8.0'
DataStore = VpFlexDataStore1
Options = []
Placement.Position = mpCenter
@ -289,38 +262,23 @@ object Form1: TForm1
Top = 232
end
object VpFlexDataStore1: TVpFlexDataStore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoConnect = False
AutoCreate = False
DayBuffer = 31
DataSources.ResourceDataSource = DsResources
DataSources.EventsDataSource = DsEvents
DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks
ResourceID = 0
Left = 136
Top = 101
ResourceFieldMappings = (

View File

@ -16,6 +16,7 @@ type
{ TForm1 }
TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton;
BtnEditRes: TButton;
DsTasks: TDataSource;
@ -46,6 +47,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
@ -88,6 +90,22 @@ begin
VpResourceEditDialog1.AddNewResource;
end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Edits the currently selected resource
procedure TForm1.BtnEditResClick(Sender: TObject);
begin