mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 05:39:14 +02:00
implemented dialog editing for TTIGrid
git-svn-id: trunk@6539 -
This commit is contained in:
parent
30274bba1b
commit
70b4d7f37a
@ -152,6 +152,7 @@ type
|
|||||||
procedure SelectEditor; override;
|
procedure SelectEditor; override;
|
||||||
procedure DoEditorControlKeyUp(Sender: TObject; var Key: Word;
|
procedure DoEditorControlKeyUp(Sender: TObject; var Key: Word;
|
||||||
Shift: TShiftState); virtual;
|
Shift: TShiftState); virtual;
|
||||||
|
procedure EditorHide; override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -172,6 +173,7 @@ type
|
|||||||
procedure MapCell(aCol, aRow: integer;
|
procedure MapCell(aCol, aRow: integer;
|
||||||
var ObjectIndex, PropertyIndex: integer;
|
var ObjectIndex, PropertyIndex: integer;
|
||||||
var CellType: TTIGridCellType);
|
var CellType: TTIGridCellType);
|
||||||
|
function GetCurrentGridProperty: TTIGridProperty;
|
||||||
public
|
public
|
||||||
property DefaultRowHeight default 20;
|
property DefaultRowHeight default 20;
|
||||||
property Filter: TTypeKinds read FFilter write SetFilter default AllTypeKinds;
|
property Filter: TTypeKinds read FFilter write SetFilter default AllTypeKinds;
|
||||||
@ -523,6 +525,8 @@ procedure TTICustomGrid.DoEditorControlKeyUp(Sender: TObject; var Key: Word;
|
|||||||
|
|
||||||
var
|
var
|
||||||
Relaxed: Boolean;
|
Relaxed: Boolean;
|
||||||
|
GridProp: TTIGridProperty;
|
||||||
|
CurLink: TCustomPropertyLink;
|
||||||
begin
|
begin
|
||||||
if Sender=nil then ;
|
if Sender=nil then ;
|
||||||
if (Shift=[ssCtrl]) then begin
|
if (Shift=[ssCtrl]) then begin
|
||||||
@ -550,10 +554,33 @@ begin
|
|||||||
if Relaxed then MoveSel(False, ColCount-1, Row)
|
if Relaxed then MoveSel(False, ColCount-1, Row)
|
||||||
else MoveSel(False, Col, RowCount-1);
|
else MoveSel(False, Col, RowCount-1);
|
||||||
end;
|
end;
|
||||||
|
VK_F2:
|
||||||
|
begin
|
||||||
|
GridProp:=GetCurrentGridProperty;
|
||||||
|
if (GridProp<>nil) and (paDialog in GridProp.Editor.GetAttributes) then
|
||||||
|
begin
|
||||||
|
GridProp.Editor.Edit;
|
||||||
|
CurLink:=GetPropertyLinkOfComponent(Editor);
|
||||||
|
if CurLink<>nil then
|
||||||
|
CurLink.LoadFromProperty;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTICustomGrid.EditorHide;
|
||||||
|
var
|
||||||
|
PropLink: TCustomPropertyLink;
|
||||||
|
begin
|
||||||
|
if Editor<>nil then begin
|
||||||
|
PropLink:=GetPropertyLinkOfComponent(Editor);
|
||||||
|
if PropLink<>nil then
|
||||||
|
PropLink.SetObjectAndProperty(nil,'');
|
||||||
|
end;
|
||||||
|
inherited EditorHide;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TTICustomGrid.Create(TheOwner: TComponent);
|
constructor TTICustomGrid.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
@ -842,6 +869,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TTICustomGrid.GetCurrentGridProperty: TTIGridProperty;
|
||||||
|
var
|
||||||
|
ObjectIndex: Integer;
|
||||||
|
PropertyIndex: Integer;
|
||||||
|
CellType: TTIGridCellType;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
MapCell(Col,Row,ObjectIndex,PropertyIndex,CellType);
|
||||||
|
if CellType=tgctValue then
|
||||||
|
Result:=Properties[PropertyIndex];
|
||||||
|
end;
|
||||||
|
|
||||||
{ TTIGridProperty }
|
{ TTIGridProperty }
|
||||||
|
|
||||||
procedure TTIGridProperty.EditorControlKeyUp(Sender: TObject; var Key: Word;
|
procedure TTIGridProperty.EditorControlKeyUp(Sender: TObject; var Key: Word;
|
||||||
|
@ -509,7 +509,6 @@ type
|
|||||||
procedure doTopleftChange(DimChg: Boolean);
|
procedure doTopleftChange(DimChg: Boolean);
|
||||||
function EditorCanProcessKey(var Key: Char): boolean;
|
function EditorCanProcessKey(var Key: Char): boolean;
|
||||||
procedure EditorGetValue;
|
procedure EditorGetValue;
|
||||||
procedure EditorHide;
|
|
||||||
procedure EditorPos;
|
procedure EditorPos;
|
||||||
procedure EditorSelectAll;
|
procedure EditorSelectAll;
|
||||||
procedure EditorShowChar(Ch: Char);
|
procedure EditorShowChar(Ch: Char);
|
||||||
@ -617,6 +616,7 @@ type
|
|||||||
procedure EditordoSetValue; virtual;
|
procedure EditordoSetValue; virtual;
|
||||||
function EditorCanAcceptKey(const ch: Char): boolean; virtual;
|
function EditorCanAcceptKey(const ch: Char): boolean; virtual;
|
||||||
function EditorIsReadOnly: boolean; virtual;
|
function EditorIsReadOnly: boolean; virtual;
|
||||||
|
procedure EditorHide; virtual;
|
||||||
procedure EditorShow(const SelAll: boolean); virtual;
|
procedure EditorShow(const SelAll: boolean); virtual;
|
||||||
procedure GetAutoFillColumnInfo(const Index: Integer; var aMin,aMax,aPriority: Integer); dynamic;
|
procedure GetAutoFillColumnInfo(const Index: Integer; var aMin,aMax,aPriority: Integer); dynamic;
|
||||||
function GetFixedcolor: TColor; virtual;
|
function GetFixedcolor: TColor; virtual;
|
||||||
|
Loading…
Reference in New Issue
Block a user