RxFPC:replase button icon in RxDateEdit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6164 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-02-01 08:47:24 +00:00
parent c5b3e83d2a
commit 749f1cd764
3 changed files with 58 additions and 43 deletions

View File

@@ -37,7 +37,7 @@ interface
uses uses
Classes, SysUtils, LCLType, LMessages, Graphics, MaskEdit, Controls, EditBtn, Classes, SysUtils, LCLType, LMessages, Graphics, MaskEdit, Controls, EditBtn,
rxpickdate, rxdateutil; LCLVersion, rxpickdate, rxdateutil;
type type
{ TCustomDateEdit } { TCustomDateEdit }
@@ -114,6 +114,7 @@ type
procedure EditKeyDown(var Key: word; Shift: TShiftState); override; procedure EditKeyDown(var Key: word; Shift: TShiftState); override;
procedure EditKeyPress( var Key: char); override; procedure EditKeyPress( var Key: char); override;
function GetDefaultGlyph: TBitmap; override;
function GetDefaultGlyphName: String; override; function GetDefaultGlyphName: String; override;
function CreatePopupForm:TPopupCalendar; function CreatePopupForm:TPopupCalendar;
procedure DoEnter; override; procedure DoEnter; override;
@@ -152,6 +153,8 @@ type
{ TRxDateEdit } { TRxDateEdit }
TRxDateEdit = class(TCustomRxDateEdit) TRxDateEdit = class(TCustomRxDateEdit)
protected
procedure Loaded; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
property PopupVisible; property PopupVisible;
@@ -180,7 +183,7 @@ type
property Glyph; property Glyph;
property MaxLength; property MaxLength;
property NotInThisMonthColor; property NotInThisMonthColor;
property NumGlyphs; property NumGlyphs default {$IF lcl_fullversion >= 1090000} 1 {$ELSE} 2 {$ENDIF};
property OKCaption; property OKCaption;
property ParentFont; property ParentFont;
property ParentShowHint; property ParentShowHint;
@@ -223,6 +226,7 @@ type
function PaintComboEdit(Editor: TCustomMaskEdit; const AText: string; function PaintComboEdit(Editor: TCustomMaskEdit; const AText: string;
AAlignment: TAlignment; StandardPaint: Boolean; AAlignment: TAlignment; StandardPaint: Boolean;
var ACanvas: TControlCanvas; var Message: TLMPaint): Boolean; var ACanvas: TControlCanvas; var Message: TLMPaint): Boolean;
function EditorTextMargins(Editor: TCustomMaskEdit): TPoint; function EditorTextMargins(Editor: TCustomMaskEdit): TPoint;
implementation implementation
@@ -374,6 +378,16 @@ end;
{ TRxDateEdit } { TRxDateEdit }
procedure TRxDateEdit.Loaded;
begin
inherited Loaded;
{$IF lcl_fullversion >= 1090000}
{ if Assigned(Glyph)
and (Glyph.Equals(RxDateGlyph)) then}
NumGlyphs:=1;
{$ENDIF}
end;
constructor TRxDateEdit.Create(AOwner: TComponent); constructor TRxDateEdit.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
@@ -398,15 +412,6 @@ begin
UpdateMask; UpdateMask;
end; end;
{
function TCustomRxDateEdit.GetCalendarStyle: TCalendarStyle;
begin
if FPopup <> nil then
Result := csPopup
else
Result := csDialog;
end;
}
function TCustomRxDateEdit.GetDate: TDateTime; function TCustomRxDateEdit.GetDate: TDateTime;
begin begin
if DefaultToday then Result := SysUtils.Date if DefaultToday then Result := SysUtils.Date
@@ -699,11 +704,6 @@ begin
if Focused then inherited SelectAll; if Focused then inherited SelectAll;
end; end;
end; end;
{ FPopup.Show(AOrigin);
SetWindowPos(Handle, HWND_TOP, Origin.X, Origin.Y, 0, 0,
SWP_NOACTIVATE or SWP_SHOWWINDOW or SWP_NOSIZE);
Visible := True;}
end; end;
procedure TCustomRxDateEdit.ApplyDate(Value: TDateTime); procedure TCustomRxDateEdit.ApplyDate(Value: TDateTime);
@@ -849,16 +849,32 @@ begin
end; end;
end; end;
function TCustomRxDateEdit.GetDefaultGlyph: TBitmap;
var
R: TRect;
B: TCustomBitmap;
begin
{$IF lcl_fullversion < 01090000}
Result := nil;
{$ELSE}
Result := DateGlyph;
{$ENDIF}
end;
function TCustomRxDateEdit.GetDefaultGlyphName: String; function TCustomRxDateEdit.GetDefaultGlyphName: String;
begin begin
{$IFDEF LINUX} {$IF lcl_fullversion < 01090000}
Result:='picDateEdit'; {$IFDEF LINUX}
Result:='picDateEdit';
{$ELSE}
{$IFDEF WINDOWS}
Result:='picDateEdit';
{$ELSE}
Result:='';
{$ENDIF}
{$ENDIF}
{$ELSE} {$ELSE}
{$IFDEF WINDOWS} Result:=ResBtnCalendar
Result:='picDateEdit';
{$ELSE}
Result:='';
{$ENDIF}
{$ENDIF} {$ENDIF}
end; end;
@@ -893,23 +909,13 @@ begin
ControlState := ControlState + [csCreating]; ControlState := ControlState + [csCreating];
try try
UpdateFormat; UpdateFormat;
(*
{$IFDEF DEFAULT_POPUP_CALENDAR}
FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF});
FPopup.OnCloseUp := @PopupCloseUp;
FPopup.Color := FPopupColor;
FPopup.Visible:=false;
{$ELSE}
FPopup:=nil; FPopup:=nil;
{$ENDIF DEFAULT_POPUP_CALENDAR}
*)
FPopup:=nil;
// GlyphKind := gkDefault; { force update }
finally finally
ControlState := ControlState - [csCreating]; ControlState := ControlState - [csCreating];
end; end;
// Glyph:=LoadBitmapFromLazarusResource('picDateEdit'); {$IF lcl_fullversion < 01090000}
NumGlyphs := 2; NumGlyphs := 2;
{$ENDIF}
end; end;
destructor TCustomRxDateEdit.Destroy; destructor TCustomRxDateEdit.Destroy;

View File

@@ -878,7 +878,6 @@ type
procedure RemoveTools(ATools:TRxDBGridAbstractTools); procedure RemoveTools(ATools:TRxDBGridAbstractTools);
procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer); procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer);
function GetFieldDisplayText(AField:TField; ACollumn:TRxColumn):string;
procedure FillFilterData; procedure FillFilterData;
protected protected
FRxDbGridLookupComboEditor: TCustomControl; FRxDbGridLookupComboEditor: TCustomControl;
@@ -895,6 +894,7 @@ type
procedure AdjustEditorBounds(NewCol,NewRow:Integer); override; procedure AdjustEditorBounds(NewCol,NewRow:Integer); override;
procedure LinkActive(Value: Boolean); override; procedure LinkActive(Value: Boolean); override;
function GetFieldDisplayText(AField:TField; ACollumn:TRxColumn):string;
procedure DefaultDrawCellA(aCol, aRow: integer; aRect: TRect; procedure DefaultDrawCellA(aCol, aRow: integer; aRect: TRect;
aState: TGridDrawState); aState: TGridDrawState);
procedure DefaultDrawTitle(aCol, aRow: integer; aRect: TRect; procedure DefaultDrawTitle(aCol, aRow: integer; aRect: TRect;
@@ -910,6 +910,8 @@ type
procedure DrawRow(ARow: Integer); override; procedure DrawRow(ARow: Integer); override;
procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override; procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override;
procedure DrawFooterRows; virtual; procedure DrawFooterRows; virtual;
procedure DrawCellBitmap(RxColumn: TRxColumn; aRect: TRect;
aState: TGridDrawState; AImageIndex: integer); virtual;
procedure DoTitleClick(ACol: longint; ACollumn: TRxColumn; Shift: TShiftState); virtual; procedure DoTitleClick(ACol: longint; ACollumn: TRxColumn; Shift: TShiftState); virtual;
procedure MouseMove(Shift: TShiftState; X, Y: integer); override; procedure MouseMove(Shift: TShiftState; X, Y: integer); override;
@@ -919,8 +921,6 @@ type
procedure KeyPress(var Key: char); override; procedure KeyPress(var Key: char); override;
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override; procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
function CreateColumns: TGridColumns; override; function CreateColumns: TGridColumns; override;
procedure DrawCellBitmap(RxColumn: TRxColumn; aRect: TRect;
aState: TGridDrawState; AImageIndex: integer); virtual;
procedure SetEditText(ACol, ARow: longint; const Value: string); override; procedure SetEditText(ACol, ARow: longint; const Value: string); override;
procedure ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer); override; procedure ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer); override;
@@ -5424,8 +5424,11 @@ begin
aRect.Top := (aRect.Top + aRect.Bottom - H) div 2; aRect.Top := (aRect.Top + aRect.Bottom - H) div 2;
aRect.Bottom := aRect.Top + H; aRect.Bottom := aRect.Top + H;
end; end;
{$IFDEF lcl_version < '1.9.0.0'}
RxColumn.ImageList.StretchDraw(Canvas, AImageIndex, aRect); RxColumn.ImageList.StretchDraw(Canvas, AImageIndex, aRect);
{$ELSE}
RxColumn.ImageList.Draw(Canvas, aRect.Left, aRect.Top, AImageIndex);
{$ENDIF}
end; end;
procedure TRxDBGrid.SetEditText(ACol, ARow: longint; const Value: string); procedure TRxDBGrid.SetEditText(ACol, ARow: longint; const Value: string);

View File

@@ -123,6 +123,9 @@ end;
{ TRxColInfo } { TRxColInfo }
Type
THackRxDBGrid = class(TRxDBGrid);
constructor TRxColInfo.Create; constructor TRxColInfo.Create;
begin begin
inherited Create; inherited Create;
@@ -380,21 +383,24 @@ begin
TfrMemoView(View).FillColor:=C; TfrMemoView(View).FillColor:=C;
end; end;
S:= FDataField.DisplayText; //F.Col.Field.DisplayText; { S:= FDataField.DisplayText; //F.Col.Field.DisplayText;
if Assigned(FDataCollumn) and (FDataCollumn.KeyList.Count > 0) and (FDataCollumn.PickList.Count > 0) then if Assigned(FDataCollumn) and (FDataCollumn.KeyList.Count > 0) and (FDataCollumn.PickList.Count > 0) then
begin begin
J := FDataCollumn.KeyList.IndexOf(S); J := FDataCollumn.KeyList.IndexOf(S);
if (J >= 0) and (J < FDataCollumn.PickList.Count) then if (J >= 0) and (J < FDataCollumn.PickList.Count) then
S := FDataCollumn.PickList[j]; S := FDataCollumn.PickList[j];
end end
else else}
if (rxpoHideZeroValues in FOptions) and Assigned(FDataField) and (FDataField.DataType in [ftSmallint, ftInteger, ftWord, if (rxpoHideZeroValues in FOptions) and Assigned(FDataField) and (FDataField.DataType in [ftSmallint, ftInteger, ftWord,
ftFloat, ftCurrency, ftLargeint]) and (FDataField.AsFloat = 0) then ftFloat, ftCurrency, ftLargeint]) and (FDataField.AsFloat = 0) then
S:=''; S:=''
else
S:=THackRxDBGrid(RxDBGrid).GetFieldDisplayText(FDataField, FDataCollumn);
Memo[0] := S; Memo[0] := S;
TfrMemoView(View).Alignment:=FDataCollumn.Alignment; TfrMemoView(View).Alignment:=FDataCollumn.Alignment;
end else end
else
if Copy(S, 1, 7) = 'Header_' then if Copy(S, 1, 7) = 'Header_' then
begin begin
TfrMemoView(View).Alignment:=F.Col.Title.Alignment; TfrMemoView(View).Alignment:=F.Col.Title.Alignment;