Skip to content

Commit

Permalink
Fix losing focus when changing component properties
Browse files Browse the repository at this point in the history
  • Loading branch information
superswanman committed Dec 1, 2016
1 parent a164200 commit 266c2b0
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/UComponentTray.pas
Expand Up @@ -182,41 +182,11 @@ function IsNonVisualComponent(Instance: TPersistent): Boolean; overload;
end;

procedure HideNonVisualComponents;
var
surface: IComponentDesignSurface;
options: TDesignerOptions;
surfaceOptions: TDesignSurfaceOptions;

function GetComponentDesignSurface: IComponentDesignSurface;
var
ctx: TRttiContext;
typ: TRttiType;
fld: TRttiField;
begin
typ := ctx.GetType(TComponentRoot);
if typ = nil then Exit;
fld := typ.GetField('FSurface');
if fld = nil then Exit;
Result := IComponentDesignSurface(fld.GetValue((ActiveRoot as IInternalRoot).Implementor).AsInterface);
end;

begin
if ActiveRoot = nil then Exit;
if ActiveRoot.Root is TDataModule then Exit;
surface := GetComponentDesignSurface;
if surface = nil then Exit;

(BorlandIDEServices as IOTAServices).GetEnvironmentOptions.Values['ShowNonVisualComponents'] := False;

ActiveDesigner.Environment.GetDesignerOptions(options);
options.ShowNonVisualComponents := False;
surfaceOptions.DisplayGrid := options.DisplayGrid;
surfaceOptions.GridSize := Point(options.GridSizeX, options.GridSizeY);
surfaceOptions.ShowComponentCaptions := options.ShowComponentCaptions;
surfaceOptions.ShowDesignerHints := options.ShowDesignerHints;
surfaceOptions.ShowNonVisualComponents := options.ShowNonVisualComponents;
surfaceOptions.ShowExtendedControlHints := options.ShowExtendedControlHints;
surface.SetOptions(surfaceOptions);
end;

function GetComponentTray(AControl: TWinControl): TComponentTray;
Expand Down

0 comments on commit 266c2b0

Please sign in to comment.