RxFPC - fix compile with new TEditButton from Lazarus 1.3. For old version uncomment in rx.inc DEFINE OLD_EDITBUTTON

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2936 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-04-09 17:33:24 +00:00
parent f32fa5b568
commit 45cdc9ae23
9 changed files with 115 additions and 29 deletions

View File

@ -66,11 +66,16 @@ type
procedure LMCut(var Message: TLMessage); message LM_CUT; procedure LMCut(var Message: TLMessage); message LM_CUT;
procedure LMPaste(var Message: TLMessage); message LM_PASTE; procedure LMPaste(var Message: TLMessage); message LM_PASTE;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
{$IFDEF OLD_EDITBUTTON}
procedure Change; override; procedure Change; override;
procedure DoButtonClick (Sender: TObject); override;
{$ELSE}
procedure ButtonClick; override;
procedure EditChange; override;
{$ENDIF}
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure EditingDone; override; procedure EditingDone; override;
Procedure RunDialog; virtual; Procedure RunDialog; virtual;
procedure DoButtonClick (Sender: TObject); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -104,7 +109,11 @@ type
procedure LMCut(var Message: TLMessage); message LM_CUT; procedure LMCut(var Message: TLMessage); message LM_CUT;
procedure LMPaste(var Message: TLMessage); message LM_PASTE; procedure LMPaste(var Message: TLMessage); message LM_PASTE;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
{$IFDEF OLD_EDITBUTTON}
procedure Change; override; procedure Change; override;
{$ELSE}
procedure EditChange; override;
{$ENDIF}
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure EditingDone; override; procedure EditingDone; override;
Procedure RunDialog; override; Procedure RunDialog; override;
@ -159,7 +168,7 @@ end;
procedure TDBDateEdit.SetReadOnly(const AValue: Boolean); procedure TDBDateEdit.SetReadOnly(const AValue: Boolean);
begin begin
inherited SetReadOnly(AValue); inherited ReadOnly:=AValue;
FDataLink.ReadOnly:=AValue; FDataLink.ReadOnly:=AValue;
end; end;
@ -207,11 +216,19 @@ begin
end; end;
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TDBDateEdit.Change; procedure TDBDateEdit.Change;
{$ELSE}
procedure TDBDateEdit.EditChange;
{$ENDIF}
begin begin
if Assigned(FDataLink) then if Assigned(FDataLink) then
FDataLink.Modified; FDataLink.Modified;
{$IFDEF OLD_EDITBUTTON}
inherited Change; inherited Change;
{$ELSE}
inherited EditChange;
{$ENDIF}
end; end;
procedure TDBDateEdit.Notification(AComponent: TComponent; Operation: TOperation procedure TDBDateEdit.Notification(AComponent: TComponent; Operation: TOperation
@ -241,9 +258,17 @@ begin
FDataLink.UpdateRecord; FDataLink.UpdateRecord;
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TDBDateEdit.DoButtonClick(Sender: TObject); procedure TDBDateEdit.DoButtonClick(Sender: TObject);
{$ELSE}
procedure TDBDateEdit.ButtonClick;
{$ENDIF}
begin begin
{$IFDEF OLD_EDITBUTTON}
inherited DoButtonClick(Sender); inherited DoButtonClick(Sender);
{$ELSE}
inherited ButtonClick;
{$ENDIF}
RunDialog; RunDialog;
end; end;
@ -429,10 +454,18 @@ begin
end; end;
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TRxDBCalcEdit.Change; procedure TRxDBCalcEdit.Change;
{$ELSE}
procedure TRxDBCalcEdit.EditChange;
{$ENDIF}
begin begin
FDataLink.Modified; FDataLink.Modified;
{$IFDEF OLD_EDITBUTTON}
inherited Change; inherited Change;
{$ELSE}
inherited EditChange;
{$ENDIF}
end; end;
procedure TRxDBCalcEdit.Notification(AComponent: TComponent; procedure TRxDBCalcEdit.Notification(AComponent: TComponent;

View File

@ -75,8 +75,8 @@ msgstr "Campo '%s' no usado en expresión de filtro"
#: rxdconst.sexprbadnulltest #: rxdconst.sexprbadnulltest
#, fuzzy #, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'" #| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'" msgid "NULL-values enabled in '=' и '<>'"
msgstr "Valor nulo habilitado en '=' y '<>'" msgstr "Valor nulo habilitado en '=' y '<>'"
#: rxdconst.sexprexpected #: rxdconst.sexprexpected

View File

@ -74,7 +74,7 @@ msgid "Field '%s' not used in filter expression"
msgstr "" msgstr ""
#: rxdconst.sexprbadnulltest #: rxdconst.sexprbadnulltest
msgid "NULL-values enabled in '=' и '<>'" msgid "NULL-values enabled in '=' и '<>'"
msgstr "" msgstr ""
#: rxdconst.sexprexpected #: rxdconst.sexprexpected

View File

@ -75,8 +75,8 @@ msgstr "Поле '%s' не может быть использовано в вы
#: rxdconst.sexprbadnulltest #: rxdconst.sexprbadnulltest
#, fuzzy #, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'" #| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'" msgid "NULL-values enabled in '=' и '<>'"
msgstr "NULL-значения разрешены только в выражениях '=' и '<>'" msgstr "NULL-значения разрешены только в выражениях '=' и '<>'"
#: rxdconst.sexprexpected #: rxdconst.sexprexpected

View File

@ -84,8 +84,8 @@ msgstr "Поле '%s' не може бути використане в вира
#: rxdconst.sexprbadnulltest #: rxdconst.sexprbadnulltest
#, fuzzy #, fuzzy
#| msgid "NULL-values enabled in '=' и '<>'" #| msgid "NULL-values enabled in '=' и '<>'"
msgid "NULL-values enabled in '=' и '<>'" msgid "NULL-values enabled in '=' и '<>'"
msgstr "NULL-значення дозволені тільки у виразах '=' і '<>'" msgstr "NULL-значення дозволені тільки у виразах '=' і '<>'"
#: rxdconst.sexprexpected #: rxdconst.sexprexpected

View File

@ -52,6 +52,8 @@
// //
{.$DEFINE DBDateEdit_OLD} {.$DEFINE DBDateEdit_OLD}
{.$DEFINE OLD_EDITBUTTON}
{$if FPC_FULLVERSION<20701} {$if FPC_FULLVERSION<20701}
{$DEFINE NoAutomatedBookmark} {$DEFINE NoAutomatedBookmark}
{$DEFINE RX_USE_LCL_DEVEL} {$DEFINE RX_USE_LCL_DEVEL}

View File

@ -620,6 +620,8 @@ type
procedure CollumnSortListClear; procedure CollumnSortListClear;
procedure CollumnSortListApply; procedure CollumnSortListApply;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function DatalinkActive: boolean; function DatalinkActive: boolean;
procedure AdjustEditorBounds(NewCol,NewRow:Integer); override; procedure AdjustEditorBounds(NewCol,NewRow:Integer); override;
procedure LinkActive(Value: Boolean); override; procedure LinkActive(Value: Boolean); override;
@ -930,7 +932,11 @@ type
FGrid: TRxDBGrid; FGrid: TRxDBGrid;
FCol, FRow: integer; FCol, FRow: integer;
protected protected
{$IFDEF OLD_EDITBUTTON}
procedure Change; override; procedure Change; override;
{$ELSE}
procedure EditChange; override;
{$ENDIF}
procedure KeyDown(var Key: word; Shift: TShiftState); override; procedure KeyDown(var Key: word; Shift: TShiftState); override;
procedure WndProc(var TheMessage: TLMessage); override; procedure WndProc(var TheMessage: TLMessage); override;
@ -1286,11 +1292,19 @@ end;
{ TRxDBGridDateEditor } { TRxDBGridDateEditor }
{$IFDEF OLD_EDITBUTTON}
procedure TRxDBGridDateEditor.Change; procedure TRxDBGridDateEditor.Change;
{$ELSE}
procedure TRxDBGridDateEditor.EditChange;
{$ENDIF}
var var
D:TDateTime; D:TDateTime;
begin begin
{$IFDEF OLD_EDITBUTTON}
inherited Change; inherited Change;
{$ELSE}
inherited EditChange;
{$ENDIF}
if Assigned(FGrid) and FGrid.DatalinkActive and not FGrid.EditorIsReadOnly then if Assigned(FGrid) and FGrid.DatalinkActive and not FGrid.EditorIsReadOnly then
begin begin
if not (FGrid.DataSource.DataSet.State in dsEditModes) then if not (FGrid.DataSource.DataSet.State in dsEditModes) then
@ -2597,6 +2611,15 @@ begin
FSortingNow:=false; FSortingNow:=false;
end; end;
procedure TRxDBGrid.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if Assigned(Datalink) and (AComponent = DataSource) and (Operation = opRemove) then
begin
ShowMessage('i');
end;
end;
function TRxDBGrid.UpdateRowsHeight: integer; function TRxDBGrid.UpdateRowsHeight: integer;
var var
i, J, H, H1, H2:integer; i, J, H, H1, H2:integer;

View File

@ -112,7 +112,11 @@ type
procedure UpdateKeyValue; procedure UpdateKeyValue;
protected protected
property PopUpFormOptions:TPopUpFormOptions read FPopUpFormOptions write SetPopUpFormOptions; property PopUpFormOptions:TPopUpFormOptions read FPopUpFormOptions write SetPopUpFormOptions;
{$IFDEF OLD_EDITBUTTON}
procedure DoButtonClick (Sender: TObject); override; procedure DoButtonClick (Sender: TObject); override;
{$ELSE}
procedure ButtonClick; override;
{$ENDIF}
function GetDefaultGlyphName: String; override; function GetDefaultGlyphName: String; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure InternalClosePopup(AResult:boolean);virtual; procedure InternalClosePopup(AResult:boolean);virtual;
@ -528,9 +532,17 @@ begin
Text:=FLookupDataLink.DataSet.FieldByName(S).AsString; Text:=FLookupDataLink.DataSet.FieldByName(S).AsString;
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TRxCustomDBLookupEdit.DoButtonClick (Sender: TObject); procedure TRxCustomDBLookupEdit.DoButtonClick (Sender: TObject);
{$ELSE}
procedure TRxCustomDBLookupEdit.ButtonClick;
{$ENDIF}
begin begin
{$IFDEF OLD_EDITBUTTON}
inherited DoButtonClick(Sender); inherited DoButtonClick(Sender);
{$ELSE}
inherited ButtonClick;
{$ENDIF}
if PopupVisible then if PopupVisible then
HideList HideList
else else

View File

@ -106,10 +106,19 @@ type
procedure HidePopup; virtual; procedure HidePopup; virtual;
procedure ShowPopup(AOrigin: TPoint); virtual; procedure ShowPopup(AOrigin: TPoint); virtual;
procedure ApplyDate(Value: TDateTime); virtual; procedure ApplyDate(Value: TDateTime); virtual;
{$IFDEF OLD_EDITBUTTON}
procedure Change; override; procedure Change; override;
{$ELSE}
procedure EditChange; override;
{$ENDIF}
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override; procedure KeyPress(var Key: Char); override;
{$IFDEF OLD_EDITBUTTON}
procedure DoButtonClick (Sender: TObject); override; procedure DoButtonClick (Sender: TObject); override;
{$ELSE}
procedure ButtonClick; override;
{$ENDIF}
function GetDefaultGlyphName: String; override; function GetDefaultGlyphName: String; override;
function CreatePopupForm:TPopupCalendar; function CreatePopupForm:TPopupCalendar;
@ -532,16 +541,14 @@ end;
procedure TCustomRxDateEdit.AcceptValue(const AValue: TDateTime); procedure TCustomRxDateEdit.AcceptValue(const AValue: TDateTime);
begin begin
SetDate(AValue); SetDate(AValue);
// UpdatePopupVisible;
if Modified then if Modified then
{$IFDEF OLD_EDITBUTTON}
inherited Change; inherited Change;
{$ELSE}
inherited EditChange;
{$ENDIF}
end; end;
{procedure TCustomRxDateEdit.SetPopupValue(const Value: Variant);
begin
end;}
procedure TCustomRxDateEdit.UpdateFormat; procedure TCustomRxDateEdit.UpdateFormat;
begin begin
case YearDigits of case YearDigits of
@ -685,7 +692,7 @@ begin
FAccept:=FPopup.ShowModal = mrOk; FAccept:=FPopup.ShowModal = mrOk;
if CanFocus then SetFocus; if CanFocus then SetFocus;
if FAccept and EditCanModify then if FAccept {and EditCanModify} then
begin begin
D:=FPopup.Date; D:=FPopup.Date;
if AcceptPopup(D) then if AcceptPopup(D) then
@ -708,9 +715,18 @@ begin
SelectAll; SelectAll;
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TCustomRxDateEdit.Change; procedure TCustomRxDateEdit.Change;
{$ELSE}
procedure TCustomRxDateEdit.EditChange;
{$ENDIF}
begin begin
if not FFormatting then inherited Change; if not FFormatting then
{$IFDEF OLD_EDITBUTTON}
inherited Change;
{$ELSE}
inherited EditChange;
{$ENDIF}
end; end;
procedure TCustomRxDateEdit.KeyDown(var Key: Word; Shift: TShiftState); procedure TCustomRxDateEdit.KeyDown(var Key: Word; Shift: TShiftState);
@ -766,26 +782,27 @@ begin
inherited KeyPress(Key); inherited KeyPress(Key);
end; end;
{$IFDEF OLD_EDITBUTTON}
procedure TCustomRxDateEdit.DoButtonClick(Sender: TObject); procedure TCustomRxDateEdit.DoButtonClick(Sender: TObject);
{$ELSE}
procedure TCustomRxDateEdit.ButtonClick;
{$ENDIF}
var var
D: TDateTime; D: TDateTime;
A: Boolean; A: Boolean;
begin begin
{$IFDEF OLD_EDITBUTTON}
inherited DoButtonClick(Sender); inherited DoButtonClick(Sender);
{$ELSE}
inherited ButtonClick;
{$ENDIF}
if CalendarStyle <> csDialog then if CalendarStyle <> csDialog then
// if FPopup <> nil then PopupDropDown(True)
begin
{ if FPopupVisible then
PopupCloseUp(FPopup, True)
else}
PopupDropDown(True);
end
else else
if CalendarStyle = csDialog then if CalendarStyle = csDialog then
begin begin
D := Self.Date; D := Self.Date;
A := SelectDate(D, DialogTitle, FStartOfWeek, FWeekends, A := SelectDate(D, DialogTitle, FStartOfWeek, FWeekends, FWeekendColor, FCalendarHints);
FWeekendColor, FCalendarHints);
if CanFocus then SetFocus; if CanFocus then SetFocus;
if A then if A then
begin begin
@ -793,7 +810,6 @@ begin
if A then if A then
begin begin
Self.Date := D; Self.Date := D;
// if FFocused then
inherited SelectAll; inherited SelectAll;
end; end;
end; end;