tvplanit: Lots of cosmetic changes

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4771 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-18 21:03:53 +00:00
parent a089da3b74
commit 1e89c2e60f
8 changed files with 673 additions and 702 deletions

View File

@ -159,6 +159,10 @@ msgctxt "vpsr.rscalendartoday"
msgid "Today"
msgstr "Heute"
#: vpsr.rscalendarweekabbr
msgid "CW"
msgstr "KW"
#: vpsr.rscancelbtn
msgid "Cancel"
msgstr "Abbrechen"

View File

@ -149,6 +149,10 @@ msgctxt "vpsr.rscalendartoday"
msgid "Today"
msgstr ""
#: vpsr.rscalendarweekabbr
msgid "CW"
msgstr ""
#: vpsr.rscancelbtn
msgid "Cancel"
msgstr ""

View File

@ -113,10 +113,10 @@ type
procedure DisplayCurrentCountry;
procedure ResizeControls;
public
Resource : TVpResource;
Contact : TVpContact;
ReturnCode : TVpEditorReturnCode;
ControlLink : TVpControlLink;
Resource: TVpResource;
Contact: TVpContact;
ReturnCode: TVpEditorReturnCode;
ControlLink: TVpControlLink;
procedure PopulateSelf;
procedure DePopulateSelf;
procedure ArrangeControls;
@ -124,9 +124,9 @@ type
TVpContactEditDialog = class(TVpBaseDialog)
protected {private}
ceEditDlg : TContactEditForm;
ceContact : TVpContact;
ceResource : TVpResource;
ceEditDlg: TContactEditForm;
ceContact: TVpContact;
ceResource: TVpResource;
public
function Execute(Contact: TVpContact): Boolean; reintroduce;
function AddNewContact: Boolean;
@ -150,7 +150,7 @@ uses
{== Utility functions ===================================}
function Max(const a, b : Integer) : Integer;
function Max(const a, b: Integer): Integer;
begin
if a >= b then
Result := a
@ -254,9 +254,9 @@ end;
procedure TContactEditForm.PopulateSelf;
var
CurCountry : Integer;
i : TVpPhoneType;
j : TVpCategoryType;
CurCountry: Integer;
pt: TVpPhoneType;
ct: TVpCategoryType;
begin
NameEdit.Text := AssembleName(Contact);
@ -296,12 +296,12 @@ begin
cboxState.Text := Contact.State;
for i := Low (TVpPhoneType) to High (TVpPhoneType) do begin
cboxPhoneLbl1.Items.Add (PhoneLabel (i));
cboxPhoneLbl2.Items.Add (PhoneLabel (i));
cboxPhoneLbl3.Items.Add (PhoneLabel (i));
cboxPhoneLbl4.Items.Add (PhoneLabel (i));
cboxPhoneLbl5.Items.Add (PhoneLabel (i));
for pt := Low (TVpPhoneType) to High (TVpPhoneType) do begin
cboxPhoneLbl1.Items.Add(PhoneLabel(pt));
cboxPhoneLbl2.Items.Add(PhoneLabel(pt));
cboxPhoneLbl3.Items.Add(PhoneLabel(pt));
cboxPhoneLbl4.Items.Add(PhoneLabel(pt));
cboxPhoneLbl5.Items.Add(PhoneLabel(pt));
end;
cboxPhoneLbl1.ItemIndex := Contact.PhoneType1;
cboxPhoneLbl2.ItemIndex := Contact.PhoneType2;
@ -309,8 +309,8 @@ begin
cboxPhoneLbl4.ItemIndex := Contact.PhoneType4;
cboxPhoneLbl5.ItemIndex := Contact.PhoneType5;
for j := Low (TVpCategoryType) to High (TVpCategoryType) do
cboxCategory.Items.Add (CategoryLabel (j));
for ct := Low (TVpCategoryType) to High (TVpCategoryType) do
cboxCategory.Items.Add(CategoryLabel(ct));
cboxCategory.ItemIndex := Contact.Category;
DisplayCurrentCountry;
@ -346,7 +346,7 @@ begin
cboxState.Visible := False;
end
else begin
ControlLink.Localization.CountriesToTStrings (cboxCountry.Items);
ControlLink.Localization.CountriesToTStrings(cboxCountry.Items);
CountryLbl.FocusControl := cboxCountry;
cboxCountry.Visible := True;
edtCountry.Visible := False;
@ -372,14 +372,13 @@ type
TLabelArray = array[0..9] of TLabel;
var
Labels : TLabelArray;
LargestLabel : Integer;
WidestField : Integer;
i : Integer;
j : Integer;
OldFont : TFont;
FieldTop : Integer;
delta : Integer;
Labels: TLabelArray;
LargestLabel: Integer;
WidestField: Integer;
i, j: Integer;
OldFont: TFont;
FieldTop: Integer;
delta: Integer;
begin
{ Note: The resizing algorithm is dependent upon the labels having their
@ -413,21 +412,22 @@ begin
try
Canvas.Font.Assign (cboxCountry.Font);
try
for j := 0 to cboxCountry.Items.Count - 1 do begin
i := Canvas.TextWidth (cboxCountry.Items[j]);
if i > WidestField then
WidestField := i;
end;
WidestField := WidestField + ComboArrowWidth;
cboxCountry.Width := WidestField;
for j := 0 to cboxCountry.Items.Count - 1 do begin
i := Canvas.TextWidth(cboxCountry.Items[j]);
if i > WidestField then
WidestField := i;
end;
WidestField := WidestField + ComboArrowWidth;
cboxCountry.Width := WidestField;
finally
Canvas.Font.Assign (OldFont);
Canvas.Font.Assign(OldFont);
end;
finally
OldFont.Free;
end;
if (cboxCountry.Left + cboxCountry.Width + FormRightBorder > MinFormWidth) and
(not cboxState.Visible) then
(not cboxState.Visible)
then
Width := cboxCountry.Left + cboxCountry.Width + FormRightBorder
else
Width := MinFormWidth;
@ -438,23 +438,24 @@ begin
OldFont := TFont.Create;
try
OldFont.Assign(Canvas.Font);
Canvas.Font.Assign (cboxCountry.Font);
Canvas.Font.Assign(cboxCountry.Font);
try
for j := 0 to cboxState.Items.Count - 1 do begin
i := Canvas.TextWidth (cboxState.Items[j]);
i := Canvas.TextWidth(cboxState.Items[j]);
if i > WidestField then
WidestField := i;
end;
WidestField := WidestField + ComboArrowWidth;
cboxState.Width := WidestField;
finally
Canvas.Font.Assign (OldFont);
Canvas.Font.Assign(OldFont);
end;
finally
OldFont.Free;
end;
if (cboxState.Left + cboxState.Width + FormRightBorder > MinFormWidth) and
(not cboxCountry.Visible) then
(not cboxCountry.Visible)
then
Width := cboxState.Left + cboxState.Width + FormRightBorder
else
Width := MinFormWidth;
@ -502,14 +503,13 @@ end;
procedure TContactEditForm.DisplayCurrentCountry;
var
Idx : Integer;
begin
if not Assigned (ControlLink) then
if not Assigned(ControlLink) then
Exit;
Idx := ControlLink.Localization.CountryNameToIndex (cboxCountry.Text);
Idx := ControlLink.Localization.CountryNameToIndex(cboxCountry.Text);
if Idx > -1 then begin
ControlLink.Localization.StatesToTStrings (Idx, cboxState.Items);
ControlLink.Localization.StatesToTStrings(Idx, cboxState.Items);
if ControlLink.Localization.Countries.Items[Idx].Address1Visible then begin
AddrLbl.Visible := True;

View File

@ -44,10 +44,10 @@ type
TVpCustomDBDataStore = class(TVpCustomDataStore)
protected {private}
FReadOnly : Boolean;
FAfterPostEvents : TNotifyEvent;
FAfterPostTasks : TNotifyEvent;
FAfterPostContacts : TNotifyEvent;
FAfterPostResources : TNotifyEvent;
FAfterPostEvents : TNotifyEvent;
FAfterPostTasks : TNotifyEvent;
FAfterPostContacts : TNotifyEvent;
FAfterPostResources : TNotifyEvent;
{ property getters }
function GetResourceTable : TDataset; virtual; abstract;
@ -91,10 +91,10 @@ type
procedure PostTasks; override;
procedure PostResources; override;
{ - Added}
procedure PurgeResource(Res: TVpResource); override;
procedure PurgeEvents(Res: TVpResource); override;
procedure PurgeContacts(Res: TVpResource); override;
procedure PurgeTasks(Res: TVpResource); override;
procedure PurgeResource(Res: TVpResource); override;
procedure PurgeEvents(Res: TVpResource); override;
procedure PurgeContacts(Res: TVpResource); override;
procedure PurgeTasks(Res: TVpResource); override;
{ - End}
procedure SetResourceByName(Value: string); override;
procedure CreateFieldDefs(const TableName : string;
@ -102,18 +102,18 @@ type
procedure CreateIndexDefs(const TableName : string;
IndexDefs : TIndexDefs); virtual;
published
{events}
property AfterPostEvents : TNotifyEvent
read FAfterPostEvents write FAfterPostEvents;
property AfterPostContacts : TNotifyEvent
read FAfterPostContacts write FAfterPostContacts;
property AfterPostTasks : TNotifyEvent
read FAfterPostTasks write FAfterPostTasks;
property AfterPostResources : TNotifyEvent
read FAfterPostResources write FAfterPostResources;
end;
published
{events}
property AfterPostEvents : TNotifyEvent
read FAfterPostEvents write FAfterPostEvents;
property AfterPostContacts : TNotifyEvent
read FAfterPostContacts write FAfterPostContacts;
property AfterPostTasks : TNotifyEvent
read FAfterPostTasks write FAfterPostTasks;
property AfterPostResources : TNotifyEvent
read FAfterPostResources write FAfterPostResources;
end;
{ Constants for index names }
const
VpcIndexNameResID = 'ResID_ndx';
@ -892,17 +892,17 @@ begin
end;
end else if TableName = EventsTableName then begin
with IndexDefs do begin
{ added a new index on the ResourceID and StartTime fields. }
{ added a new index on the ResourceID and StartTime fields. }
{ this index is used by the FlashFiler 2 DataStore for setting ranges }
{ instead of using filters on the Events table. }
{ tables created with unpatched 1.0 or 1.01 versions of Visual PlanIt }
{ will not have this new index available so they will continue to use }
{ filters. }
with AddIndexDef do begin
Name := 'rid_st_ndx';
Fields := 'ResourceID;StartTime';
Options := [ixCaseInsensitive];
end;
with AddIndexDef do begin
Name := 'rid_st_ndx';
Fields := 'ResourceID;StartTime';
Options := [ixCaseInsensitive];
end;
with AddIndexDef do begin
Name := 'st_ndx';
Fields := 'StartTime';
@ -982,7 +982,7 @@ begin
ResourceTable.First;
while not ResourceTable.EOF do begin
{ Load this resource into memory }
Res := Resources.AddResource(-1);
Res := Resources.AddResource(-1);
Res.Loading := true;
Res.ResourceID := ResourceTable.FieldByName('ResourceID').AsInteger;
Res.Description := ResourceTable.FieldByName('Description').AsString;
@ -1084,8 +1084,9 @@ begin
if (Resource <> nil) then
with ContactsTable do begin
SetFilterCriteria(ContactsTable, False,
ResourceTable.FieldByName('ResourceID').AsInteger,
0, 0);
ResourceTable.FieldByName('ResourceID').AsInteger,
0, 0
);
First;
while not EOF do begin
Contact := Resource.Contacts.AddContact(GetNextID(ContactsTableName));
@ -1146,8 +1147,9 @@ begin
if (Resource <> nil) then
with TasksTable do begin
SetFilterCriteria(TasksTable, False,
ResourceTable.FieldByName('ResourceID').AsInteger,
0, 0);
ResourceTable.FieldByName('ResourceID').AsInteger,
0, 0
);
First;
while not EOF do begin
Task := Resource.Tasks.AddTask(GetNextID(TasksTableName));
@ -1187,25 +1189,24 @@ begin
if (Resource <> nil) and Resource.ContactsDirty then begin
{ Dump this resource's dirty contacts to the DB }
if ResourceTable.Locate('ResourceID', Resource.ResourceID, []) then begin
SetFilterCriteria(ContactsTable, False, Resource.ResourceID,
0, 0);
SetFilterCriteria(ContactsTable, False, Resource.ResourceID, 0, 0);
for I := pred(Resource.Contacts.Count) downto 0 do begin
Contact := Resource.Contacts.GetContact(I);
{ if the delete flag is set then delete the record }
{ and free the event instance }
if Contact.Deleted then begin
{ if the delete flag is set then delete the record }
{ and free the event instance }
if Contact.Deleted then begin
if ContactsTable.Locate('RecordID', Contact.RecordID, [])
then ContactsTable.Delete;
Contact.Free;
Continue;
end;
then ContactsTable.Delete;
Contact.Free;
Continue;
end;
if Contact.Changed then begin
if ContactsTable.Locate('RecordID', Contact.RecordID, []) then
{ this event already exists in the database so update it }
ContactsTable.Edit
else begin
ContactsTable.Edit
else begin
{ this record doesn't exist in the database, so it's a new event }
ContactsTable.Append;
end;
@ -1274,14 +1275,14 @@ begin
Contact.Changed := false;
end;
end;
end;
end;
Resource.ContactsDirty := false;
if not Loading then
NotifyDependents;
if Assigned(AfterPostContacts) then
FAfterPostContacts(self);
if Assigned(AfterPostContacts) then
FAfterPostContacts(self);
end;
end;
{=====}
@ -1296,26 +1297,25 @@ begin
{ Dump this resource's dirty events to the DB }
if ResourceTable.Locate('ResourceID', Resource.ResourceID, [])
then begin
SetFilterCriteria(EventsTable, False, Resource.ResourceID,
0, 0);
SetFilterCriteria(EventsTable, False, Resource.ResourceID, 0, 0);
for J := pred(Resource.Schedule.EventCount) downto 0 do begin
Event := Resource.Schedule.GetEvent(J);
{ if the delete flag is set then delete it from the database }
{ and free the event instance }
if Event.Deleted then begin
if EventsTable.Locate('RecordID', Event.RecordID, []) then
EventsTable.Delete;
Event.Free;
Continue;
end;
{ and free the event instance }
if Event.Deleted then begin
if EventsTable.Locate('RecordID', Event.RecordID, []) then
EventsTable.Delete;
Event.Free;
Continue;
end;
if Event.Changed then begin
if EventsTable.Locate('RecordID', Event.RecordID, []) then
{ this event already exists in the database so update it }
EventsTable.Edit
else begin
EventsTable.Edit
else begin
EventsTable.Append;
end;
try
@ -1366,15 +1366,15 @@ begin
Event.Changed := false;
end;
end;
end;
end;
Resource.EventsDirty := false;
Resource.Schedule.Sort;
Resource.Schedule.Sort;
if not Loading then
NotifyDependents;
if Assigned(AfterPostEvents) then
FAfterPostEvents(self);
if Assigned(AfterPostEvents) then
FAfterPostEvents(self);
end;
end;
{=====}
@ -1388,30 +1388,28 @@ begin
{ Dump this resource's dirty contacts to the DB }
if ResourceTable.Locate('ResourceID', Resource.ResourceID, [])
then begin
SetFilterCriteria(TasksTable, False, Resource.ResourceID,
0, 0);
SetFilterCriteria(TasksTable, False, Resource.ResourceID, 0, 0);
for I := pred(Resource.Tasks.Count) downto 0 do begin
Task := Resource.Tasks.GetTask(I);
{ if the delete flag is set then delete the record }
{ and free the event instance }
if Task.Deleted then begin
if TasksTable.Locate('RecordID', Task.RecordID, []) then
TasksTable.Delete;
Task.Free;
Continue;
end;
{ if the delete flag is set then delete the record }
{ and free the event instance }
if Task.Deleted then begin
if TasksTable.Locate('RecordID', Task.RecordID, []) then
TasksTable.Delete;
Task.Free;
Continue;
end;
if Task.Changed then begin
if TasksTable.Locate('RecordID', Task.RecordID, [])
then
{ this event already exists in the database so }
{ update it }
TasksTable.Edit
else
{ this record doesn't exist in the database, so }
{ it's a new event }
then
{ this event already exists in the database so update it }
TasksTable.Edit
else
{ this record doesn't exist in the database, so }
{ it's a new event }
TasksTable.Append;
try
TasksTable.FieldByName('ResourceID').AsInteger := Resource.ResourceID;
@ -1445,11 +1443,11 @@ begin
end;
Resource.TasksDirty := false;
if not Loading then
NotifyDependents;
if not Loading then
NotifyDependents;
if Assigned(AfterPostTasks) then
FAfterPostTasks(self);
if Assigned(AfterPostTasks) then
FAfterPostTasks(self);
end;
end;
{=====}
@ -1468,25 +1466,25 @@ begin
for I := 0 to pred(Resources.Count) do begin
Res := Resources.Items[I];
if (Res <> nil) and Res.Deleted then begin
PurgeEvents(Res);
PurgeContacts(Res);
PurgeTasks(Res);
if (Res <> nil) and Res.Deleted then begin
PurgeEvents(Res);
PurgeContacts(Res);
PurgeTasks(Res);
if ResourceTable.Locate('ResourceID', Res.ResourceID, [])
then ResourceTable.Delete;
if Resource = Res then
ResourceID := -1;
Res.Free;
Continue;
end;
then ResourceTable.Delete;
if Resource = Res then
ResourceID := -1;
Res.Free;
Continue;
end;
{ Dump this resource to the DB }
if (Res <> nil) and Res.Changed then begin
with ResourceTable do begin
if Locate('ResourceID', Res.ResourceID, []) then
{ existing record found }
Edit
else
{ existing record found }
Edit
else
{ this is a new record}
Append;
@ -1523,11 +1521,11 @@ begin
Res.Changed := false;
end;
end;
if not Loading then
NotifyDependents;
if not Loading then
NotifyDependents;
if Assigned(AfterPostEvents) then
FAfterPostEvents(self);
if Assigned(AfterPostEvents) then
FAfterPostEvents(self);
end;
finally
Loading := false;
@ -1536,37 +1534,37 @@ end;
{=====}
{ - Added}
procedure TVpCustomDBDataStore.PurgeResource(Res: TVpResource);
begin
Res.Deleted := true;
PostResources;
Load;
end;
{=====}
procedure TVpCustomDBDataStore.PurgeResource(Res: TVpResource);
begin
Res.Deleted := true;
PostResources;
Load;
end;
{=====}
procedure TVpCustomDBDataStore.PurgeEvents(Res: TVpResource);
begin
procedure TVpCustomDBDataStore.PurgeEvents(Res: TVpResource);
begin
{ Purging the events from the database is done by the descendant !!.01}
{ classes !!.01}
inherited;
end;
{=====}
inherited;
end;
{=====}
procedure TVpCustomDBDataStore.PurgeContacts(Res: TVpResource);
begin
procedure TVpCustomDBDataStore.PurgeContacts(Res: TVpResource);
begin
{ Purging the contacts from the database is done by the descendant !!.01}
{ classes !!.01}
inherited;
end;
{=====}
inherited;
end;
{=====}
procedure TVpCustomDBDataStore.PurgeTasks(Res: TVpResource);
begin
procedure TVpCustomDBDataStore.PurgeTasks(Res: TVpResource);
begin
{ Purging the tasks from the database is done by the descendant !!.01}
{ classes !!.01}
inherited;
end;
{=====}
inherited;
end;
{=====}
{ - End}
procedure TVpCustomDBDataStore.SetResourceByName(Value: string);
@ -1603,8 +1601,7 @@ begin
SetFilterCriteria(ContactsTable, False, Resource.ResourceID, 0, 0);
First;
while not EOF do begin
Contact := Resource.Contacts.AddContact(
FieldByName('RecordID').AsInteger);
Contact := Resource.Contacts.AddContact(FieldByName('RecordID').AsInteger);
Contact.Loading := true;
// Contact.RecordID := FieldByName('RecordID').AsInteger;
Contact.FirstName := FieldByName('FirstName').AsString;
@ -1668,17 +1665,16 @@ begin
{ Load this resource's events into memory }
with EventsTable do begin
SetFilterCriteria(EventsTable, True, Resource.ResourceID,
TimeRange.StartTime,
TimeRange.EndTime);
SetFilterCriteria(EventsTable, True, Resource.ResourceID, TimeRange.StartTime, TimeRange.EndTime);
First;
while not EventsTable.EOF do
begin
Event := Resource.Schedule.AddEvent(
FieldByName('RecordID').AsInteger,
Event := Resource.Schedule.AddEvent(
FieldByName('RecordID').AsInteger,
FieldByName('StartTime').AsDateTime,
FieldByName('EndTime').AsDateTime);
FieldByName('EndTime').AsDateTime
);
if Event <> nil then begin
Event.Loading := true; {prevents the events changed flag from being set}
// Event.RecordID := FieldByName('RecordID').AsInteger;
@ -1729,8 +1725,7 @@ begin
SetFilterCriteria(TasksTable, False, Resource.ResourceID, 0, 0);
First;
while not EOF do begin
Task := Resource.Tasks.AddTask(
FieldByName('RecordID').AsInteger);
Task := Resource.Tasks.AddTask(FieldByName('RecordID').AsInteger);
Task.Loading := true;
// Task.RecordID := FieldByName('RecordID').AsInteger;
Task.Complete := FieldByName('Complete').AsBoolean;

View File

@ -116,6 +116,7 @@ type
procedure FormShow(Sender: TObject);
procedure StartTimeExit(Sender: TObject);
procedure EndTimeExit(Sender: TObject);
private { Private declarations }
{$IFDEF LCL}
StartTime: TTimeEdit;
@ -132,8 +133,10 @@ type
procedure PopLists;
procedure LoadCaptions;
procedure DoPlaySound(Sender: TObject; const AWavFile: String; AMode: TVpPlaySoundMode);
protected
property Datastore: TVpCustomDatastore read FDatastore write FDatastore;
public { Public declarations }
Event: TVpEvent;
CatColorMap: TVpCategoryColorMap;
@ -142,7 +145,7 @@ type
Conflicts : Integer;
TimeFormat: TVpTimeFormat;
AlarmWavPath: string;
FLastEndTime : TDateTime;
FLastEndTime : TDateTime;
procedure PopulateDialog;
procedure DePopulateDialog;
@ -387,7 +390,7 @@ begin
Category.ItemIndex := Event.Category;
FLastEndTime := Event.EndTime;
FLastEndTime := Event.EndTime;
end;
{=====}
@ -455,22 +458,21 @@ end;
procedure TDlgEventEdit.EndTimeChange(Sender: TObject);
function IsMidnight(ATime: TDateTime) : Boolean;
begin
begin
Result := ATime = Trunc(ATime);
end;
var
ET: TDateTime;
end;
var
ET: TDateTime;
begin
{ Verify the value is valid }
try
ET := StrToTime(EndTime.Text);
if (IsMidnight(ET)) and (not IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date + 1
EndDate.Date := EndDate.Date + 1
else if (not IsMidnight(ET)) and (IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date - 1;
FLastEndTime := ET;
EndDate.Date := EndDate.Date - 1;
FLastEndTime := ET;
except
EndTime.Color := clRed;
EndTime.SetFocus;
@ -512,7 +514,7 @@ begin
Hour := (Minute div 15) div 4;
MinStr := IntToStr(Minute mod 60);
if MinStr = '0' then MinStr := '00';
if TimeFormat = tf24Hour then
if TimeFormat = tf24Hour then
StringList.Add(IntToStr(Hour) + ':' + MinStr)
else begin
if Hour > 12 then Hour := Hour - 12;
@ -643,7 +645,6 @@ begin
if Visible then
FCustomInterval.SetFocus;
end;
end;
{=====}
@ -709,7 +710,7 @@ begin
inherited Create(AOwner);
FPlacement.Position := mpCenterTop;
FPlacement.Height := 415;
FPlacement.Width := 710;
FPlacement.Width := 710;
end;
{=====}
@ -746,7 +747,9 @@ begin
Result := false;
if DataStore <> nil then begin
ceEvent := DataStore.Resource.Schedule.AddEvent(
DataStore.GetNextID(EventsTableName), StartTime, EndTime);
DataStore.GetNextID(EventsTableName),
StartTime, EndTime
);
if ceEvent <> nil then begin
Result := Execute(ceEvent);
if (not Result) or (ceEvent = nil) then
@ -756,18 +759,18 @@ begin
end;
{=====}
procedure TDlgEventEdit.StartTimeExit(Sender: TObject);
var
ST : TDateTime;
begin
procedure TDlgEventEdit.StartTimeExit(Sender: TObject);
var
ST : TDateTime;
begin
{ Verify the value is valid }
try
try
ST := StartDate.Date + StrToTime(StartTime.Text);
except
StartTime.Color := clRed;
StartTime.SetFocus;
Exit;
end;
end;
StartTime.Color := clWindow;
{ If the end time is less than the start time then change the end }
@ -775,12 +778,12 @@ begin
if ST > EndDate.Date + StrToTime (EndTime.Text) then
EndTime.Text := FormatDateTime('hh:nn', ST + 30 / MinutesInDay);
end;
end;
procedure TDlgEventEdit.EndTimeExit(Sender: TObject);
var
procedure TDlgEventEdit.EndTimeExit(Sender: TObject);
var
ET: TDateTime;
begin
begin
{ Verify the value is valid }
try
ET := EndDate.Date + StrToTime(EndTime.Text);
@ -796,7 +799,7 @@ begin
if ET < StartDate.Date + StrToTime (StartTime.Text) then
StartTime.Text := FormatDateTime('hh:nn', ET - 30 / MinutesInDay);
end;
end;
end.

View File

@ -123,6 +123,7 @@ resourcestring
RSMinutes = 'Minutes';
RSHours = 'Hours';
RSDays = 'Days';
RSCalendarWeekAbbr = 'CW'; // Abbreviation of "calendar week"
{WARNINGS}
RSPermanent = 'This operation cannot be undone!';

View File

@ -90,10 +90,10 @@ type
TVpTaskEditDialog = class(TVpBaseDialog)
protected {private}
teEditDlg : TTaskEditForm;
teTask : TVpTask;
teEditDlg: TTaskEditForm;
teTask: TVpTask;
public
constructor Create(AOwner : TComponent); override;
constructor Create(AOwner: TComponent); override;
function Execute(Task: TVpTask): Boolean; reintroduce;
function AddNewTask: Boolean;
published
@ -145,13 +145,11 @@ begin
DetailsMemo.Text := Task.Details;
CompleteCB.Checked := Task.Complete;
if Task.CompletedOn <> 0 then
CompletedOnLbl.Caption := RSCompletedOn + ' ' +
FormatDateTime(ShortDateFormat, Task.CompletedOn)
CompletedOnLbl.Caption := RSCompletedOn + ' ' + FormatDateTime(ShortDateFormat, Task.CompletedOn)
else
CompletedOnLbl.Visible := False;
CompletedOnLbl.Visible := CompleteCB.Checked;
CreatedOnLbl.Caption := RSCreatedOn + ' ' +
FormatDateTime(ShortDateFormat, Task.CreatedOn);
CreatedOnLbl.Caption := RSCreatedOn + ' ' + FormatDateTime(ShortDateFormat, Task.CreatedOn);
DueDateEdit.Left := DueDateLbl.Left + GetLabelWidth(DueDateLbl) + 8;
end;
@ -188,8 +186,8 @@ end;
constructor TVpTaskEditDialog.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
FPlacement.Height := 340;
FPlacement.Width := 545;
FPlacement.Height := 340;
FPlacement.Width := 545;
end;
function TVpTaskEditDialog.Execute(Task: TVpTask): Boolean;
@ -198,8 +196,8 @@ var
begin
Result := false;
teTask := Task;
if (teTask <> nil) and (DataStore <> nil) and
(DataStore.Resource <> nil) then begin
if (teTask <> nil) and (DataStore <> nil) and (DataStore.Resource <> nil) then
begin
Application.CreateForm(TTaskEditForm, TaskEditForm);
try
DoFormPlacement(TaskEditForm);

File diff suppressed because it is too large Load Diff