mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 05:40:24 +02:00
implemented TDBGroupBox
git-svn-id: trunk@4642 -
This commit is contained in:
parent
48414330a4
commit
b78c09452b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -809,6 +809,7 @@ lcl/include/customupdown.inc svneol=native#text/pascal
|
||||
lcl/include/dbcheckbox.inc svneol=native#text/pascal
|
||||
lcl/include/dbcombobox.inc svneol=native#text/pascal
|
||||
lcl/include/dbedit.inc svneol=native#text/pascal
|
||||
lcl/include/dbgroupbox.inc svneol=native#text/pascal
|
||||
lcl/include/dblistbox.inc svneol=native#text/pascal
|
||||
lcl/include/dbmemo.inc svneol=native#text/pascal
|
||||
lcl/include/dbradiogroup.inc svneol=native#text/pascal
|
||||
|
@ -249,7 +249,7 @@ Type
|
||||
protected
|
||||
procedure Change; virtual;
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
Operation: TOperation); override;
|
||||
procedure DataChange(Sender: TObject);
|
||||
procedure UpdateData(Sender: TObject);
|
||||
property DataLink: TFieldDataLink read FDataLink;
|
||||
@ -304,6 +304,8 @@ Type
|
||||
function GetFieldCheckState: TCheckBoxState; virtual;
|
||||
procedure DataChange(Sender: TObject); virtual;
|
||||
procedure UpdateData(Sender: TObject); virtual;
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -363,6 +365,8 @@ Type
|
||||
procedure SetComboText(const NewText: string); virtual;
|
||||
procedure DataChange(Sender: TObject); virtual;
|
||||
procedure EditingChange(Sender: TObject); virtual;
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
procedure UpdateData(Sender: TObject); virtual;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
@ -427,6 +431,8 @@ Type
|
||||
function WordWrapIsStored: boolean; virtual;
|
||||
procedure DataChange(Sender: TObject); virtual;
|
||||
procedure EditingChange(Sender: TObject); virtual;
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
procedure UpdateData(Sender: TObject); virtual;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
@ -456,6 +462,61 @@ Type
|
||||
property Visible;
|
||||
property WordWrap stored WordWrapIsStored;
|
||||
end;
|
||||
|
||||
|
||||
{ TDBGroupBox }
|
||||
|
||||
TDBGroupBox = class(TCustomGroupBox)
|
||||
FDataLink: TFieldDataLink;
|
||||
function GetDataField: string;
|
||||
function GetDataSource: TDataSource;
|
||||
function GetField: TField;
|
||||
procedure SetDataField(const AValue: string);
|
||||
procedure SetDataSource(const AValue: TDataSource);
|
||||
protected
|
||||
procedure DataChange(Sender: TObject); virtual;
|
||||
procedure Loaded; override;
|
||||
procedure Notification(AComponent: TComponent;
|
||||
Operation: TOperation); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
property Caption;
|
||||
property ClientHeight;
|
||||
property ClientWidth;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Ctl3D;
|
||||
property DataField: string read GetDataField write SetDataField;
|
||||
property DataSource: TDataSource read GetDataSource write SetDataSource;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnResize;
|
||||
property ParentColor;
|
||||
property ParentCtl3D;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
|
||||
// ToDo: Move this to db.pp
|
||||
function ExtractFieldName(const Fields: string; var StartPos: Integer): string;
|
||||
@ -789,12 +850,16 @@ end;
|
||||
{$Include dbcheckbox.inc}
|
||||
{$Include dbcombobox.inc}
|
||||
{$Include dbmemo.inc}
|
||||
{$Include dbgroupbox.inc}
|
||||
|
||||
end.
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.8 2003/09/18 14:00:09 mattias
|
||||
implemented TDBGroupBox
|
||||
|
||||
Revision 1.7 2003/09/18 12:15:01 mattias
|
||||
fixed is checks for TCustomXXX controls
|
||||
|
||||
|
@ -118,6 +118,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDBCheckBox.Notification(AComponent: TComponent; Operation: TOperation
|
||||
);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
if (Operation=opRemove) then begin
|
||||
if (FDataLink<>nil) and (AComponent=DataSource) then
|
||||
DataSource:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDBCheckBox.ValueEqualsField(const AValue, AFieldText: string
|
||||
): boolean;
|
||||
begin
|
||||
|
@ -101,6 +101,16 @@ begin
|
||||
// ToDo
|
||||
end;
|
||||
|
||||
procedure TDBComboBox.Notification(AComponent: TComponent; Operation: TOperation
|
||||
);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
if (Operation=opRemove) then begin
|
||||
if (FDataLink<>nil) and (AComponent=DataSource) then
|
||||
DataSource:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDBComboBox.UpdateData(Sender: TObject);
|
||||
begin
|
||||
// ToDo: use Field.Text
|
||||
|
86
lcl/include/dbgroupbox.inc
Normal file
86
lcl/include/dbgroupbox.inc
Normal file
@ -0,0 +1,86 @@
|
||||
// included by dbctrls.pas
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
{ TDBGroupBox }
|
||||
|
||||
function TDBGroupBox.GetDataField: string;
|
||||
begin
|
||||
Result:=FDataLink.FieldName;
|
||||
end;
|
||||
|
||||
function TDBGroupBox.GetDataSource: TDataSource;
|
||||
begin
|
||||
Result:=FDataLink.DataSource;
|
||||
end;
|
||||
|
||||
function TDBGroupBox.GetField: TField;
|
||||
begin
|
||||
Result:=FDataLink.Field;
|
||||
end;
|
||||
|
||||
procedure TDBGroupBox.SetDataField(const AValue: string);
|
||||
begin
|
||||
FDataLink.FieldName:=AValue;
|
||||
end;
|
||||
|
||||
procedure TDBGroupBox.SetDataSource(const AValue: TDataSource);
|
||||
begin
|
||||
FDataLink.DataSource:=AValue;
|
||||
end;
|
||||
|
||||
procedure TDBGroupBox.DataChange(Sender: TObject);
|
||||
begin
|
||||
if FDataLink.Field<>nil then
|
||||
Caption:=FDataLink.Field.DisplayText
|
||||
else
|
||||
Caption:='';
|
||||
end;
|
||||
|
||||
procedure TDBGroupBox.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
//need to make sure the state is updated on first load
|
||||
if (csDesigning in ComponentState) then
|
||||
DataChange(Self);
|
||||
end;
|
||||
|
||||
procedure TDBGroupBox.Notification(AComponent: TComponent; Operation: TOperation
|
||||
);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
if (Operation=opRemove) then begin
|
||||
if (FDataLink<>nil) and (AComponent=DataSource) then
|
||||
DataSource:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TDBGroupBox.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FDataLink:=TFieldDataLink.Create;
|
||||
FDataLink.Control:=Self;
|
||||
FDataLink.OnDataChange:=@DataChange;
|
||||
end;
|
||||
|
||||
destructor TDBGroupBox.Destroy;
|
||||
begin
|
||||
FDataLink.Free;
|
||||
FDataLink:=nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
// included by dbctrls.pas
|
||||
|
@ -98,6 +98,15 @@ begin
|
||||
inherited ReadOnly:=not (FDataLink.Editing and FDBMemoLoaded);
|
||||
end;
|
||||
|
||||
procedure TDBMemo.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
if (Operation=opRemove) then begin
|
||||
if (FDataLink<>nil) and (AComponent=DataSource) then
|
||||
DataSource:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDBMemo.UpdateData(Sender: TObject);
|
||||
begin
|
||||
FDataLink.Field.AsString:=Text;
|
||||
|
@ -1160,7 +1160,7 @@ Begin
|
||||
OwnerObject := TObject(GetProp(Handle, 'Lazarus'));
|
||||
if OwnerObject is TWinControl then begin
|
||||
TheWinControl:=TWinControl(OwnerObject);
|
||||
if TheWinControl is TGroupBox then begin
|
||||
if TheWinControl is TCustomGroupBox then begin
|
||||
// The client area of a groupbox under win32 is the whole size, including
|
||||
// the frame. The LCL defines the client area without the frame.
|
||||
// -> Adjust the client size
|
||||
@ -2475,6 +2475,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.60 2003/09/18 14:00:09 mattias
|
||||
implemented TDBGroupBox
|
||||
|
||||
Revision 1.59 2003/08/31 17:30:49 mattias
|
||||
fixed TControl painting for win32
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user