fix RxDateEdit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1203 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75 2010-04-23 16:32:38 +00:00
parent dd05680bf4
commit d402565a9a
3 changed files with 31 additions and 9 deletions

View File

@ -1513,8 +1513,9 @@ var
ArrowBmp:TBitmap; ArrowBmp:TBitmap;
begin begin
inherited Create(AOwner); inherited Create(AOwner);
Height := 23; //Height := 23;
Width := 100; Width := 100;
AutoSize:=true;
FUnfindedValue:=rxufNone; FUnfindedValue:=rxufNone;
FFieldList := TStringList.Create; FFieldList := TStringList.Create;
FValuesList:= TStringList.Create; FValuesList:= TStringList.Create;

View File

@ -235,7 +235,7 @@ type
property ToolBarStyle:TToolBarStyle read FToolBarStyle write SetToolBarStyle default tbsStandart; property ToolBarStyle:TToolBarStyle read FToolBarStyle write SetToolBarStyle default tbsStandart;
property Options:TToolPanelOptions read FOptions write SetOptions; property Options:TToolPanelOptions read FOptions write SetOptions;
property Version: Integer read FVersion write FVersion default 0; property Version: Integer read FVersion write FVersion default 0;
property ButtonAllign:TToolButtonAllign read FButtonAllign write SetButtonAllign; property ButtonAllign:TToolButtonAllign read FButtonAllign write SetButtonAllign default tbaLeft;
property Align; property Align;
property Alignment; property Alignment;
@ -1156,6 +1156,7 @@ begin
inherited Create(AOwner); inherited Create(AOwner);
FArrowBmp:=CreateArrowBitmap; FArrowBmp:=CreateArrowBitmap;
AutoSize:=false; AutoSize:=false;
FButtonAllign:=tbaLeft;
FToolbarItems:=TToolbarItems.Create(Self); FToolbarItems:=TToolbarItems.Create(Self);
if Assigned(AOwner) and not (csLoading in AOwner.ComponentState) then if Assigned(AOwner) and not (csLoading in AOwner.ComponentState) then
Align:=alTop; Align:=alTop;

View File

@ -76,7 +76,8 @@ type
FFormatting: Boolean; FFormatting: Boolean;
FPopupVisible: Boolean; FPopupVisible: Boolean;
FPopupAlign: TPopupAlign; FPopupAlign: TPopupAlign;
function GetCalendarStyle: TCalendarStyle; FCalendarStyle: TCalendarStyle;
//function GetCalendarStyle: TCalendarStyle;
function GetDate: TDateTime; function GetDate: TDateTime;
function GetPopupColor: TColor; function GetPopupColor: TColor;
function GetPopupVisible: Boolean; function GetPopupVisible: Boolean;
@ -110,6 +111,7 @@ type
procedure KeyPress(var Key: Char); override; procedure KeyPress(var Key: Char); override;
procedure DoButtonClick (Sender: TObject); override; procedure DoButtonClick (Sender: TObject); override;
function GetDefaultGlyphName: String; override; function GetDefaultGlyphName: String; override;
function CreatePopupForm:TPopupCalendar;
property BlanksChar: Char read FBlanksChar write SetBlanksChar default ' '; property BlanksChar: Char read FBlanksChar write SetBlanksChar default ' ';
property DialogTitle:TCaption Read FDialogTitle Write FDialogTitle Stored IsStoreTitle; property DialogTitle:TCaption Read FDialogTitle Write FDialogTitle Stored IsStoreTitle;
@ -124,7 +126,7 @@ type
property YearDigits: TYearDigits read FYearDigits write SetYearDigits default dyDefault; property YearDigits: TYearDigits read FYearDigits write SetYearDigits default dyDefault;
property PopupColor: TColor read GetPopupColor write SetPopupColor property PopupColor: TColor read GetPopupColor write SetPopupColor
default clBtnFace; default clBtnFace;
property CalendarStyle: TCalendarStyle read GetCalendarStyle property CalendarStyle: TCalendarStyle read FCalendarStyle//GetCalendarStyle
write SetCalendarStyle default dcsDefault; write SetCalendarStyle default dcsDefault;
property PopupVisible: Boolean read GetPopupVisible; property PopupVisible: Boolean read GetPopupVisible;
property PopupAlign: TPopupAlign read FPopupAlign write FPopupAlign default epaLeft; property PopupAlign: TPopupAlign read FPopupAlign write FPopupAlign default epaLeft;
@ -368,6 +370,7 @@ begin
UpdateMask; UpdateMask;
end; end;
{
function TCustomRxDateEdit.GetCalendarStyle: TCalendarStyle; function TCustomRxDateEdit.GetCalendarStyle: TCalendarStyle;
begin begin
if FPopup <> nil then if FPopup <> nil then
@ -375,7 +378,7 @@ begin
else else
Result := csDialog; Result := csDialog;
end; end;
}
function TCustomRxDateEdit.GetDate: TDateTime; function TCustomRxDateEdit.GetDate: TDateTime;
begin begin
if DefaultToday then Result := SysUtils.Date if DefaultToday then Result := SysUtils.Date
@ -407,9 +410,10 @@ end;
procedure TCustomRxDateEdit.SetCalendarStyle(const AValue: TCalendarStyle); procedure TCustomRxDateEdit.SetCalendarStyle(const AValue: TCalendarStyle);
begin begin
if AValue <> CalendarStyle then if AValue <> FCalendarStyle then
begin begin
case AValue of FCalendarStyle:=AValue;
{ case AValue of
csPopup: csPopup:
begin begin
if FPopup = nil then if FPopup = nil then
@ -425,7 +429,7 @@ begin
FPopup.Free; FPopup.Free;
FPopup := nil; FPopup := nil;
end; end;
end; end;}
end; end;
end; end;
@ -567,6 +571,8 @@ begin
end; end;
begin begin
if not Assigned(FPopup) then
FPopup:=CreatePopupForm;
if (FPopup <> nil) and not (ReadOnly {or FPopupVisible}) then if (FPopup <> nil) and not (ReadOnly {or FPopupVisible}) then
begin begin
P := Parent.ClientToScreen(Point(Left, Top)); P := Parent.ClientToScreen(Point(Left, Top));
@ -645,6 +651,8 @@ procedure TCustomRxDateEdit.ShowPopup(AOrigin: TPoint);
var var
FAccept:boolean; FAccept:boolean;
begin begin
if not Assigned(FPopup) then
FPopup:=CreatePopupForm;
FPopup.Left:=AOrigin.X; FPopup.Left:=AOrigin.X;
FPopup.Top:=AOrigin.Y; FPopup.Top:=AOrigin.Y;
FPopup.AutoSizeForm; FPopup.AutoSizeForm;
@ -734,7 +742,8 @@ var
A: Boolean; A: Boolean;
begin begin
inherited DoButtonClick(Sender); inherited DoButtonClick(Sender);
if FPopup <> nil then if CalendarStyle <> csDialog then
// if FPopup <> nil then
begin begin
{ if FPopupVisible then { if FPopupVisible then
PopupCloseUp(FPopup, True) PopupCloseUp(FPopup, True)
@ -766,6 +775,14 @@ begin
Result:='picDateEdit'; Result:='picDateEdit';
end; end;
function TCustomRxDateEdit.CreatePopupForm: TPopupCalendar;
begin
Result := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF});
Result.OnCloseUp := @PopupCloseUp;
Result.Color := FPopupColor;
TRxCalendarGrid(Result.Calendar).NotInThisMonthColor:=FNotInThisMonthColor;
end;
constructor TCustomRxDateEdit.Create(AOwner: TComponent); constructor TCustomRxDateEdit.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
@ -783,6 +800,7 @@ begin
ControlState := ControlState + [csCreating]; ControlState := ControlState + [csCreating];
try try
UpdateFormat; UpdateFormat;
(*
{$IFDEF DEFAULT_POPUP_CALENDAR} {$IFDEF DEFAULT_POPUP_CALENDAR}
FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF}); FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF});
FPopup.OnCloseUp := @PopupCloseUp; FPopup.OnCloseUp := @PopupCloseUp;
@ -791,6 +809,8 @@ begin
{$ELSE} {$ELSE}
FPopup:=nil; FPopup:=nil;
{$ENDIF DEFAULT_POPUP_CALENDAR} {$ENDIF DEFAULT_POPUP_CALENDAR}
*)
FPopup:=nil;
// GlyphKind := gkDefault; { force update } // GlyphKind := gkDefault; { force update }
finally finally
ControlState := ControlState - [csCreating]; ControlState := ControlState - [csCreating];