diff --git a/components/rx/trunk/Demos/PhoneBookDemo/PhoneBookDemo.lpi b/components/rx/trunk/Demos/PhoneBookDemo/PhoneBookDemo.lpi
index 9dfb58b14..d492feca8 100644
--- a/components/rx/trunk/Demos/PhoneBookDemo/PhoneBookDemo.lpi
+++ b/components/rx/trunk/Demos/PhoneBookDemo/PhoneBookDemo.lpi
@@ -1,4 +1,4 @@
-
+
@@ -60,28 +60,26 @@
-
+
-
-
-
+
-
+
@@ -108,12 +106,14 @@
+
-
+
+
-
-
+
+
@@ -122,8 +122,8 @@
-
-
+
+
@@ -165,116 +165,111 @@
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -307,4 +302,5 @@
+
diff --git a/components/rx/trunk/Demos/PhoneBookDemo/pbeditdataunit.lfm b/components/rx/trunk/Demos/PhoneBookDemo/pbeditdataunit.lfm
index 5a0e308ea..06726ce53 100644
--- a/components/rx/trunk/Demos/PhoneBookDemo/pbeditdataunit.lfm
+++ b/components/rx/trunk/Demos/PhoneBookDemo/pbeditdataunit.lfm
@@ -7,14 +7,14 @@ object pbEditDataForm: TpbEditDataForm
ClientHeight = 401
ClientWidth = 530
Position = poScreenCenter
- LCLVersion = '0.9.31'
+ LCLVersion = '1.3'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
- Height = 18
+ Height = 19
Top = 6
- Width = 72
+ Width = 66
BorderSpacing.Around = 6
Caption = 'Patronymic'
FocusControl = DBEdit1
@@ -25,9 +25,9 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Control = DBEdit1
AnchorSideTop.Side = asrBottom
Left = 6
- Height = 18
- Top = 63
- Width = 40
+ Height = 19
+ Top = 68
+ Width = 34
BorderSpacing.Around = 6
Caption = 'Name'
FocusControl = DBEdit2
@@ -38,10 +38,10 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DBEdit1
AnchorSideTop.Side = asrBottom
- Left = 235
- Height = 18
- Top = 63
- Width = 60
+ Left = 240
+ Height = 19
+ Top = 68
+ Width = 51
BorderSpacing.Around = 6
Caption = 'Surname'
FocusControl = DBEdit3
@@ -52,9 +52,9 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Control = DBEdit2
AnchorSideTop.Side = asrBottom
Left = 6
- Height = 18
- Top = 120
- Width = 41
+ Height = 19
+ Top = 130
+ Width = 37
BorderSpacing.Around = 6
Caption = 'Phone'
FocusControl = DBEdit4
@@ -64,10 +64,10 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = DBEdit3
AnchorSideTop.Side = asrBottom
- Left = 235
- Height = 18
- Top = 120
- Width = 23
+ Left = 240
+ Height = 19
+ Top = 130
+ Width = 22
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'ICQ'
@@ -79,9 +79,9 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Control = DBEdit4
AnchorSideTop.Side = asrBottom
Left = 6
- Height = 18
- Top = 177
- Width = 41
+ Height = 19
+ Top = 192
+ Width = 36
BorderSpacing.Around = 6
Caption = 'Memo'
ParentColor = False
@@ -93,8 +93,8 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 12
- Height = 27
- Top = 30
+ Height = 31
+ Top = 31
Width = 512
DataField = 'PATRONYMIC'
DataSource = pbMainForm.Datasource1
@@ -110,9 +110,9 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label3
Left = 12
- Height = 27
- Top = 87
- Width = 217
+ Height = 31
+ Top = 93
+ Width = 222
DataField = 'NAME'
DataSource = pbMainForm.Datasource1
Anchors = [akTop, akLeft, akRight]
@@ -127,10 +127,10 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
- Left = 241
- Height = 27
- Top = 87
- Width = 283
+ Left = 246
+ Height = 31
+ Top = 93
+ Width = 278
DataField = 'SURNAME'
DataSource = pbMainForm.Datasource1
Anchors = [akTop, akLeft, akRight]
@@ -145,9 +145,9 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label3
Left = 12
- Height = 27
- Top = 144
- Width = 217
+ Height = 31
+ Top = 155
+ Width = 222
DataField = 'PHONE'
DataSource = pbMainForm.Datasource1
Anchors = [akTop, akLeft, akRight]
@@ -162,10 +162,10 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
- Left = 241
- Height = 27
- Top = 144
- Width = 283
+ Left = 246
+ Height = 31
+ Top = 155
+ Width = 278
DataField = 'ICQ'
DataSource = pbMainForm.Datasource1
Anchors = [akTop, akLeft, akRight]
@@ -198,8 +198,8 @@ object pbEditDataForm: TpbEditDataForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1
Left = 12
- Height = 146
- Top = 201
+ Height = 130
+ Top = 217
Width = 512
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
@@ -217,10 +217,12 @@ object pbEditDataForm: TpbEditDataForm
item
Control = DBEdit2
FieldCaption = 'Name'
+ OnValidate = RxCloseFormValidator1Items1Validate
end
item
Control = DBEdit4
FieldCaption = 'Phone'
+ OnValidate = RxCloseFormValidator1Items2Validate
end>
left = 376
top = 8
diff --git a/components/rx/trunk/rxdbgrid.pas b/components/rx/trunk/rxdbgrid.pas
index 2a99c2993..746d76096 100644
--- a/components/rx/trunk/rxdbgrid.pas
+++ b/components/rx/trunk/rxdbgrid.pas
@@ -38,7 +38,7 @@ interface
uses
Classes, SysUtils, LResources, LCLVersion, LCLType, LCLIntf, Forms, Controls, Buttons,
Graphics, Dialogs, Grids, dbutils, DBGrids, DB, PropertyStorage, vclutils,
- LMessages, types, StdCtrls, Menus;
+ LMessages, types, StdCtrls, Menus, rxspin;
{//$if ((lcl_major = 1) and (lcl_minor = 1))}
@@ -354,6 +354,8 @@ type
FStyle: TRxColumnEditButtonStyle;
FButton:TSpeedButton;
FVisible: Boolean;
+ //
+ FSpinBtn:TRxSpinButton;
function GetGlyph: TBitmap;
function GetHint: String;
function GetNumGlyphs: Integer;
@@ -366,6 +368,9 @@ type
procedure SetStyle(AValue: TRxColumnEditButtonStyle);
procedure SetVisible(AValue: Boolean);
procedure SetWidth(AValue: Integer);
+
+ procedure DoBottomClick(Sender: TObject);
+ procedure DoTopClick(Sender: TObject);
protected
function GetDisplayName: string; override;
public
@@ -678,6 +683,7 @@ type
procedure DoEditorShow; override;
procedure EraseBackground(DC: HDC); override;
+ property Editor;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -1048,6 +1054,7 @@ end;
procedure TRxColumnEditButton.SetHint(AValue: String);
begin
FButton.Hint:=AValue;
+ FSpinBtn.Hint:=AValue;
end;
procedure TRxColumnEditButton.SetNumGlyphs(AValue: Integer);
@@ -1068,14 +1075,85 @@ end;
procedure TRxColumnEditButton.SetVisible(AValue: Boolean);
begin
- if FVisible=AValue then Exit;
+// if FVisible=AValue then Exit;
FVisible:=AValue;
- FButton.Visible:=AValue;
+
+ if AValue then
+ begin
+ if Style = ebsUpDownRx then
+ begin
+ FSpinBtn.Visible:=AValue;
+ FButton.Visible:=false;
+ end
+ else
+ begin
+ FButton.Visible:=AValue;
+ FSpinBtn.Visible:=false;
+ end;
+ end
+ else
+ begin
+ FButton.Visible:=AValue;
+ FSpinBtn.Visible:=AValue;
+ end;
end;
procedure TRxColumnEditButton.SetWidth(AValue: Integer);
begin
FButton.Width:=AValue;
+ FSpinBtn.Width:=AValue;
+end;
+
+procedure TRxColumnEditButton.DoBottomClick(Sender: TObject);
+var
+ F:TField;
+ Col:TRxColumn;
+
+ msg: TGridMessage;
+begin
+ Col:=TRxColumnEditButtons(Collection).FOwner as TRxColumn;
+ F:=Col.Field;
+
+ if Assigned(F) and (F.DataType in NumericDataTypes) then
+ begin
+ if not (F.DataSet.State in dsEditModes) then
+ F.DataSet.Edit;
+ F.Value:=F.Value + 1;
+
+ Msg.LclMsg.msg:=GM_SETVALUE;
+ Msg.Grid:=Col.Grid;
+{ Msg.Col:=FCol;
+ Msg.Row:=FRow;}
+ Msg.Value:=F.DisplayText;
+ TRxDBGrid(Col.Grid).Editor.Dispatch(Msg);
+
+ end;
+end;
+
+procedure TRxColumnEditButton.DoTopClick(Sender: TObject);
+var
+ F:TField;
+ Col:TRxColumn;
+
+ msg: TGridMessage;
+begin
+ Col:=TRxColumnEditButtons(Collection).FOwner as TRxColumn;
+ F:=Col.Field;
+
+ if Assigned(F) and (F.DataType in NumericDataTypes) then
+ begin
+ if not (F.DataSet.State in dsEditModes) then
+ F.DataSet.Edit;
+ F.Value:=F.Value - 1;
+
+ Msg.LclMsg.msg:=GM_SETVALUE;
+ Msg.Grid:=Col.Grid;
+{ Msg.Col:=FCol;
+ Msg.Row:=FRow;}
+ Msg.Value:=F.DisplayText;
+ TRxDBGrid(Col.Grid).Editor.Dispatch(Msg);
+
+ end;
end;
function TRxColumnEditButton.GetDisplayName: string;
@@ -1091,6 +1169,10 @@ begin
inherited Create(ACollection);
FButton:=TSpeedButton.Create(nil);
FButton.Glyph:=LoadLazResBitmapImage('rx_markerdown');
+ FSpinBtn:=TRxSpinButton.Create(nil);
+ FSpinBtn.OnBottomClick:=@DoBottomClick;
+ FSpinBtn.OnTopClick:=@DoTopClick;
+
FVisible:=true;
Width:=15;
end;
@@ -1098,6 +1180,7 @@ end;
destructor TRxColumnEditButton.Destroy;
begin
FreeAndNil(FButton);
+ FreeAndNil(FSpinBtn);
inherited Destroy;
end;
@@ -2606,6 +2689,7 @@ procedure TRxDBGrid.DoSetColEdtBtn;
var
R:TRxColumn;
i, w:integer;
+ SB:TGraphicControl;
begin
R:=SelectedColumn as TRxColumn;
@@ -2634,13 +2718,27 @@ begin
for i:=0 to R.EditButtons.Count-1 do
if R.EditButtons[i].Visible then
begin
+ if R.EditButtons[i].Style = ebsUpDownRx then
+ begin
+ SB:=R.EditButtons[i].FSpinBtn;
+ TRxSpinButton(SB).FocusControl:=Editor;
+ end
+ else
+ SB:=R.EditButtons[i].FButton;
+
+ SB.Parent:=Self;
+ SB.Left:=W;
+ SB.Top:=Editor.Top;
+ SB.Height:=Editor.Height;
+ SB.Visible:=true;
+{
R.EditButtons[i].FButton.Parent:=Self;
R.EditButtons[i].FButton.Left:=W;
R.EditButtons[i].FButton.Top:=Editor.Top;
R.EditButtons[i].FButton.Height:=Editor.Height;
- R.EditButtons[i].FButton.Visible:=true;
-
- W:=W+R.EditButtons[i].FButton.Width;
+ R.EditButtons[i].Visible:=true;
+}
+ W:=W+R.EditButtons[i].Width;
end;
end;
end;
@@ -4412,7 +4510,13 @@ begin
if Assigned(Editor) and Assigned(R) then
for i:=0 to R.EditButtons.Count-1 do
- R.EditButtons[i].FButton.Visible:=false;
+ begin
+// R.EditButtons[i].Visible:=false;
+ if R.EditButtons[i].Style = ebsUpDownRx then
+ R.EditButtons[i].FSpinBtn.Visible:=false
+ else
+ R.EditButtons[i].FButton.Visible:=false;
+ end;
end;
procedure TRxDBGrid.DoEditorShow;
diff --git a/components/rx/trunk/rxnew.lpk b/components/rx/trunk/rxnew.lpk
index 6b4b9092b..69544685a 100644
--- a/components/rx/trunk/rxnew.lpk
+++ b/components/rx/trunk/rxnew.lpk
@@ -26,7 +26,7 @@ Copyright (c) 1998 Master-Bank
translate to Lazarus by alexs in 2005 - 2014
"/>
-
+