implemented dialog editing for TTIGrid

git-svn-id: trunk@6539 -
This commit is contained in:
mattias 2005-01-10 21:24:27 +00:00
parent 30274bba1b
commit 70b4d7f37a
2 changed files with 40 additions and 1 deletions

View File

@ -152,6 +152,7 @@ type
procedure SelectEditor; override;
procedure DoEditorControlKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState); virtual;
procedure EditorHide; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -172,6 +173,7 @@ type
procedure MapCell(aCol, aRow: integer;
var ObjectIndex, PropertyIndex: integer;
var CellType: TTIGridCellType);
function GetCurrentGridProperty: TTIGridProperty;
public
property DefaultRowHeight default 20;
property Filter: TTypeKinds read FFilter write SetFilter default AllTypeKinds;
@ -523,6 +525,8 @@ procedure TTICustomGrid.DoEditorControlKeyUp(Sender: TObject; var Key: Word;
var
Relaxed: Boolean;
GridProp: TTIGridProperty;
CurLink: TCustomPropertyLink;
begin
if Sender=nil then ;
if (Shift=[ssCtrl]) then begin
@ -550,10 +554,33 @@ begin
if Relaxed then MoveSel(False, ColCount-1, Row)
else MoveSel(False, Col, RowCount-1);
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;
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);
begin
inherited Create(TheOwner);
@ -842,6 +869,18 @@ begin
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 }
procedure TTIGridProperty.EditorControlKeyUp(Sender: TObject; var Key: Word;

View File

@ -509,7 +509,6 @@ type
procedure doTopleftChange(DimChg: Boolean);
function EditorCanProcessKey(var Key: Char): boolean;
procedure EditorGetValue;
procedure EditorHide;
procedure EditorPos;
procedure EditorSelectAll;
procedure EditorShowChar(Ch: Char);
@ -617,6 +616,7 @@ type
procedure EditordoSetValue; virtual;
function EditorCanAcceptKey(const ch: Char): boolean; virtual;
function EditorIsReadOnly: boolean; virtual;
procedure EditorHide; virtual;
procedure EditorShow(const SelAll: boolean); virtual;
procedure GetAutoFillColumnInfo(const Index: Integer; var aMin,aMax,aPriority: Integer); dynamic;
function GetFixedcolor: TColor; virtual;