Index: cprs/trunk/CPRS-Lib/ORDtTm.pas
===================================================================
--- cprs/trunk/CPRS-Lib/ORDtTm.pas	(revision 456)
+++ cprs/trunk/CPRS-Lib/ORDtTm.pas	(revision 829)
@@ -7,8 +7,9 @@
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons,
-  Grids, Calendar, ExtCtrls, ORFn, ORNet, ORDtTmCal, Mask, ComCtrls, ORCtrls;
+  Grids, Calendar, ExtCtrls, ORFn, ORNet, ORDtTmCal, Mask, ComCtrls, OR2006Compatibility,
+  ORCtrls, VAClasses;
 
 type
-  TORfrmDtTm = class(TForm)
+  TORfrmDtTm = class(Tfrm2006Compatibility)
     bvlFrame: TBevel;
     lblDate: TPanel;
@@ -51,4 +52,6 @@
     FNowPressed:  Boolean;
     TimeIsRequired: Boolean;
+  protected
+    procedure Loaded; override;
   end;
 
@@ -75,4 +78,7 @@
   end;
 
+  // 508 class
+  TORDateButton = class (TBitBtn);
+
   { TORDateBox }
 
@@ -82,14 +88,15 @@
   end;
 
-  TORDateBox = class(TORDateEdit)
+  TORDateBox = class(TORDateEdit, IVADynamicProperty, IORBlackColorModeCompatible)
   private
     FFMDateTime: TFMDateTime;
     FDateOnly: Boolean;
     FRequireTime: Boolean;
-    FButton: TBitBtn;
+    FButton: TORDateButton;
     FFormat: string;
     FTimeIsNow: Boolean;
     FTemplateField: boolean;
     FCaption: TStaticText;
+    FBlackColorMode: boolean;
     procedure ButtonClick(Sender: TObject);
     function GetFMDateTime: TFMDateTime;
@@ -104,12 +111,15 @@
     procedure SetCaption(const Value: string);
     function  GetCaption(): string;
-                                                             
   protected
     procedure Change; override;
     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
+    property DateButton: TORDateButton read FButton;
   public
     constructor Create(AOwner: TComponent); override;
     function IsValid: Boolean;
     procedure Validate(var ErrMsg: string);
+    procedure SetBlackColorMode(Value: boolean);
+    function SupportsDynamicProperty(PropertyID: integer): boolean;
+    function GetDynamicProperty(PropertyID: integer): string;
     property Format: string read FFormat write FFormat;
     property RelativeTime: string     read GetRelativeTime;
@@ -122,12 +132,25 @@
   end;
 
-  TORDateCombo = class(TCustomPanel)
+  // 508 classes
+  TORDayCombo = class (TORComboBox);
+  TORMonthCombo = class (TORComboBox);
+  TORYearEdit = class(TMaskEdit)
+  private
+    FTemplateField: boolean;
+    procedure SetTemplateField(const Value: boolean);
+  protected
+    property TemplateField: boolean read FTemplateField write SetTemplateField;
+  end;
+
+  TORYearEditClass = Class of TORYearEdit;
+
+  TORDateCombo = class(TCustomPanel, IORBlackColorModeCompatible)
   private
     FYearChanging: boolean;
-    FMonthCombo: TORComboBox;
-    FDayCombo: TORComboBox;
-    FYearEdit: TMaskEdit;
+    FMonthCombo: TORMonthCombo;
+    FDayCombo: TORDayCombo;
+    FYearEdit: TORYearEdit;
     FYearUD: TUpDown;
-    FCalBtn: TSpeedButton;
+    FCalBtn: TORDateButton;
     FIncludeMonth: boolean;
     FIncludeDay: boolean;
@@ -141,4 +164,6 @@
     FRebuilding: boolean;
     FTemplateField: boolean;
+    FBlackColorMode: boolean;
+    FORYearEditClass: TORYearEditClass;
     procedure SetIncludeBtn(const Value: boolean);
     procedure SetIncludeDay(Value: boolean);
@@ -153,5 +178,5 @@
     procedure SetTemplateField(const Value: boolean);
   protected
-    procedure Rebuild;
+    procedure Rebuild; virtual;
     function InitDays(GetSize: boolean): integer;
     function InitMonths(GetSize: boolean): integer;
@@ -169,8 +194,15 @@
     procedure Paint; override;
     procedure Resized(Sender: TObject);
+    property MonthCombo: TORMonthCombo read FMonthCombo;
+    property DayCombo: TORDayCombo read FDayCombo;
+    property YearEdit: TORYearEdit read FYearEdit;
+    property YearUD: TUpDown read FYearUD;
+    property CalBtn: TORDateButton read FCalBtn;
+    property ORYearEditClass: TORYearEditClass read FORYearEditClass write FORYearEditClass;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     function DateText: string;
+    procedure SetBlackColorMode(Value: boolean);
     property TemplateField: boolean read FTemplateField write SetTemplateField;
     property FMDate: TFMDateTime read GetFMDate write SetFMDate;
@@ -280,4 +312,15 @@
 end;
 
+procedure LoadEllipsis(bitmap: TBitMap; BlackColorMode: boolean);
+var
+  ResName: string;
+begin
+  if BlackColorMode then
+    ResName := 'BLACK_BMP_ELLIPSIS'
+  else
+    ResName := 'BMP_ELLIPSIS';
+  bitmap.LoadFromResourceName(hInstance, ResName);
+end;
+
 { TfrmORDtTm -------------------------------------------------------------------------------- }
 
@@ -351,4 +394,5 @@
 procedure TORfrmDtTm.lstHourClick(Sender: TObject);
 begin
+  if lstHour.ItemIndex = 0 then lstMinute.Items[0] := ':01  --' else lstMinute.Items[0] := ':00  --'; //<------ NEW CODE
   if lstMinute.ItemIndex < 0 then lstMinute.ItemIndex := 0;
   lstMinuteClick(Self);
@@ -374,4 +418,5 @@
 
   AMinute := lstMinute.ItemIndex * 5;
+  if (AnHour = 0) and (AMinute = 0) then AMinute := 1;  //<-------------- NEW CODE
   FFromSelf := True;
   // if ampm time -
@@ -410,5 +455,6 @@
   begin
     x := Trim(txtTime.Text);
-    if (x='00:00') or (x='0:00') or (x='00:00:00') or (x='0:00:00') then x := '00:00:01';
+    //if (x='00:00') or (x='0:00') or (x='00:00:00') or (x='0:00:00') then x := '00:00:01';
+    if (x='00:00') or (x='0:00') or (x='00:00:00') or (x='0:00:00') then x := '00:01';  //<------- CHANGED CODE
     StrToTime(x);
     txtTime.Text := x;
@@ -420,4 +466,10 @@
 begin
   ModalResult := mrCancel;
+end;
+
+procedure TORfrmDtTm.Loaded;
+begin
+  inherited Loaded;
+  UpdateColorsFor508Compliance(Self);
 end;
 
@@ -515,5 +567,5 @@
 begin
   inherited Create(AOwner);
-  FButton := TBitBtn.Create(Self);
+  FButton := TORDateButton.Create(Self);
   FButton.Parent := Self;
   FButton.Width := 18;
@@ -521,5 +573,6 @@
   FButton.OnClick := ButtonClick;
   FButton.TabStop := False;
-  FButton.Glyph.LoadFromResourceName(hInstance, 'BMP_ELLIPSIS');
+  FBlackColorMode := False;
+  LoadEllipsis(FButton.Glyph, FALSE);
   FButton.Visible := True;
   FFormat := FMT_DATETIME;
@@ -567,4 +620,9 @@
 end;
 
+function TORDateBox.SupportsDynamicProperty(PropertyID: integer): boolean;
+begin
+  Result := (PropertyID = DynaPropAccesibilityCaption);
+end;
+
 procedure TORDateBox.ButtonClick(Sender: TObject);
 var
@@ -696,4 +754,13 @@
   if Length(x) = 0 then Result := True else Result := False;
   if Length(Text) = 0 then Result := False;
+end;
+
+procedure TORDateBox.SetBlackColorMode(Value: boolean);
+begin
+  if FBlackColorMode <> Value then
+  begin
+    FBlackColorMode := Value;
+    LoadEllipsis(FButton.Glyph, FBlackColorMode);
+  end;
 end;
 
@@ -717,4 +784,12 @@
 end;
 
+function TORDateBox.GetDynamicProperty(PropertyID: integer): string;
+begin
+  if PropertyID = DynaPropAccesibilityCaption then
+    Result := GetCaption
+  else
+    Result := '';
+end;
+
 function IsLeapYear(AYear: Integer): Boolean;
 begin
@@ -745,16 +820,7 @@
   LastYear = 2200;
 
-type
-  TORDateComboEdit = class(TMaskEdit)
-  private
-    FTemplateField: boolean;
-    procedure SetTemplateField(const Value: boolean);
-  protected
-    property TemplateField: boolean read FTemplateField write SetTemplateField;
-  end;
-
 { TORDateComboEdit }
 
-procedure TORDateComboEdit.SetTemplateField(const Value: boolean);
+procedure TORYearEdit.SetTemplateField(const Value: boolean);
 begin
   if(FTemplateField <> Value) then
@@ -779,4 +845,5 @@
   FIncludeBtn := TRUE;
   OnResize := Resized;
+  FORYearEditClass := TORYearEdit;
 end;
 
@@ -868,5 +935,5 @@
           if(not assigned(FMonthCombo)) then
           begin
-            FMonthCombo := TORComboBox.Create(Self);
+            FMonthCombo := TORMonthCombo.Create(Self);
             FMonthCombo.Parent := Self;
             FMonthCombo.Top := 0;
@@ -874,4 +941,5 @@
             FMonthCombo.Style := orcsDropDown;
             FMonthCombo.DropDownCount := 13;
+            FMonthCombo.ListItemsOnly := True;
             FMonthCombo.OnChange := MonthChanged;
           end;
@@ -888,8 +956,9 @@
             if(not assigned(FDayCombo)) then
             begin
-              FDayCombo := TORComboBox.Create(Self);
+              FDayCombo := TORDayCombo.Create(Self);
               FDayCombo.Parent := Self;
               FDayCombo.Top := 0;
               FDayCombo.Style := orcsDropDown;
+              FDayCombo.ListItemsOnly := True;
               FDayCombo.OnChange := DayChanged;
               FDayCombo.DropDownCount := 11;
@@ -914,5 +983,5 @@
         if(not assigned(FYearEdit)) then
         begin
-          FYearEdit := TORDateComboEdit.Create(Self);
+          FYearEdit := FORYearEditClass.Create(Self);
           FYearEdit.Parent := Self;
           FYearEdit.Top := 0;
@@ -922,5 +991,5 @@
         end;
         FYearEdit.Font := Font;
-        TORDateComboEdit(FYearEdit).TemplateField := FTemplateField;
+        FYearEdit.TemplateField := FTemplateField;
         Wide := GetYearSize;
         FYearEdit.Width := Wide;
@@ -947,8 +1016,9 @@
           if(not assigned(FCalBtn)) then
           begin
-            FCalBtn := TSpeedButton.Create(Self);
+            FCalBtn := TORDateButton.Create(Self);
+            FCalBtn.TabStop := FALSE;
             FCalBtn.Parent := Self;
             FCalBtn.Top := 0;
-            FCalBtn.Glyph.LoadFromResourceName(hInstance, 'BMP_ELLIPSIS');
+            LoadEllipsis(FCalBtn.Glyph, FBlackColorMode);
             FCalBtn.OnClick := BtnClicked;
           end;
@@ -973,4 +1043,14 @@
       FRebuilding := FALSE;
     end;
+  end;
+end;
+
+procedure TORDateCombo.SetBlackColorMode(Value: boolean);
+begin
+  if FBlackColorMode <> Value then
+  begin
+    FBlackColorMode := Value;
+    if assigned(FCalBtn) then    
+      LoadEllipsis(FCalBtn.Glyph, FBlackColorMode);
   end;
 end;
