ideintf: mark designer as modified after a successful drag/drop operation in the component treeview

git-svn-id: trunk@23183 -
This commit is contained in:
paul 2009-12-18 08:57:34 +00:00
parent 5d54673967
commit d84183aac1
2 changed files with 17 additions and 5 deletions

View File

@ -38,6 +38,7 @@ type
TComponentTreeView = class(TCustomTreeView)
private
FComponentList: TBackupComponentList;
FOnModified: TNotifyEvent;
FPropertyEditorHook: TPropertyEditorHook;
FImageList: TImageList;
function GetSelection: TPersistentSelectionList;
@ -53,6 +54,7 @@ type
procedure GetComponentInsertMarkAt(X, Y: Integer;
out AnInsertMarkNode: TTreeNode;
out AnInsertMarkType: TTreeViewInsertMarkType);
procedure DoModified;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -66,6 +68,7 @@ type
property PropertyEditorHook: TPropertyEditorHook
read FPropertyEditorHook write SetPropertyEditorHook;
property OnSelectionChanged;
property OnModified: TNotifyEvent read FOnModified write FOnModified;
end;
implementation
@ -301,6 +304,7 @@ begin
try
AControl.Parent := AContainer;
ok:=true;
DoModified;
except
on E: Exception do
MessageDlg(oisError,
@ -338,6 +342,7 @@ begin
else
TCollectionItem(SelNode.Data).Index := NewIndex;
ok := True;
DoModified;
except
on E: Exception do
MessageDlg(E.Message, mtError, [mbOk], 0);
@ -483,6 +488,12 @@ begin
end;
end;
procedure TComponentTreeView.DoModified;
begin
if Assigned(FOnModified) then
OnModified(Self);
end;
function TComponentTreeView.GetImageFor(APersistent: TPersistent): integer;
begin
if Assigned(APersistent) then

View File

@ -702,7 +702,7 @@ type
procedure CreateNoteBook;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure DoModified;
procedure DoModified(Sender: TObject);
function GetSelectedPersistent: TPersistent;
function GetComponentEditorForSelection: TBaseComponentEditor;
property ComponentEditor: TBaseComponentEditor read FComponentEditor write SetComponentEditor;
@ -3884,6 +3884,7 @@ begin
OnDblClick := @ComponentTreeDblClick;
OnKeyDown := @ComponentTreeKeyDown;
OnSelectionChanged := @ComponentTreeSelectionChanged;
OnModified := @DoModified;
Visible := FShowComponentTree;
Scrollbars := ssAutoBoth;
end;
@ -4471,7 +4472,7 @@ end;
procedure TObjectInspectorDlg.OnGridModified(Sender: TObject);
begin
DoModified;
DoModified(Self);
end;
procedure TObjectInspectorDlg.OnGridSelectionChange(Sender: TObject);
@ -4864,10 +4865,10 @@ begin
OnRemainingKeyUp(Self,Key,Shift);
end;
procedure TObjectInspectorDlg.DoModified;
procedure TObjectInspectorDlg.DoModified(Sender: TObject);
begin
if Assigned(FOnModified) then
FOnModified(Self)
FOnModified(Sender)
end;
function TObjectInspectorDlg.GetSelectedPersistent: TPersistent;
@ -5039,7 +5040,7 @@ begin
if not (Persistent is TCollection) then
Exit;
Collection.Add;
DoModified;
DoModified(Self);
Selection.ForceUpdate := True;
try
SetSelection(Selection);