2017-01-06 27 views
2

Obeject Inspector 하단에있는 두 개의 창은 전혀 사용하지 않으며 아래 스크린 샷과 같이 불필요하게 화면을 소비합니다. IDE를 다시 시작한 후에도이 두 창을 비활성화하는 방법은 무엇입니까? 붙박이 선택권 또는 제삼자 플러그 접속 식은 저로 좋습니다. 감사. 아래 enter image description hereDelphi XE4 IDE, Object Inspector의 하단 창을 항상 숨기는 방법

+0

당신은 패널을 숨길 수있는 플러그인을 작성할 수 있습니다. –

+0

모두 GExperts IDE 하위 메뉴의 항목처럼 보입니다. Object Inspector에 대한 구성 옵션이 있는지 확인 했습니까? 또한 마우스 오른쪽 버튼을 클릭하고 '표시'에서 '빠른 액션 패널'의 선택을 취소하십시오. 가능하다면 최종 옵션이 될 @DavidHeffernan이 – MartynA

+0

입니다. –

답변

5

XE4 코드는 제거 할 항목을 숨기는 방법을 보여줍니다 : 그들은 클래스 THotCommandsTDescriptionPane의 인스턴스입니다.

업데이트이 답변의 원래 버전은 양식을 추가로 두 원치 않는 항목을 숨길 수있는 오브젝트 인스펙터를 새로 고침 버튼을 포함하는 패키지를 요구했다. 아래 코드에서 양식을 완전히 제거 했으므로 항목이 숨겨져 완전히 자동으로 나타납니다. 이를 위해 이전 IDENotifier를 DesignNotification 개체로 바꾸고 SelectionChanged 이벤트를 사용하여 THotCommandsTDescriptionPane 컨트롤을 숨기는 코드를 호출했습니다. TDesignNotification

자동으로 작동하는 숨어있는 프로세스를 얻는 데 중요한 것으로 밝혀졌다 다른 세부 사항은 IDE 재설정 것 때문에, 0 THotCommandsTDescriptionPane 컨트롤의 Height을 설정하는 것입니다 DesignIntf.Pas의 IDesignNotification 인터페이스를 구현 해당 Visible 속성을 True으로 OI의 구성 요소 선택 후 변경합니다. 다행히도 코드가 무엇이든 Heights를 0이 아닌 값으로 재설정하지 않습니다.

분명히 코드를 포함하는 유닛을 패키지 (.Dpk) 파일에 추가 한 다음 IDE에서 패키지를 컴파일하고 설치하십시오.

코드 :

interface 

uses 
    [...]ToolsApi, DesignIntf; 

type 
    TDesignNotification = class(TInterfacedObject, IDesignNotification) 
    procedure ItemDeleted(const ADesigner: IDesigner; AItem: TPersistent); 
    procedure ItemInserted(const ADesigner: IDesigner; AItem: TPersistent); 
    procedure ItemsModified(const ADesigner: IDesigner); 
    procedure SelectionChanged(const ADesigner: IDesigner; 
     const ASelection: IDesignerSelections); 
    procedure DesignerOpened(const ADesigner: IDesigner; AResurrecting: Boolean); 
    procedure DesignerClosed(const ADesigner: IDesigner; AGoingDormant: Boolean); 
    constructor Create; 
    destructor Destroy; override; 
    private 
    procedure HideItems; 
    procedure HideFormItems(Form: TForm); 
    end; 

var 
    DesignNotification : TDesignNotification; 

implementation 

procedure SetUp; 
begin 
    DesignNotification := TDesignNotification.Create; 
    RegisterDesignNotification(DesignNotification); 
end; 

constructor TDesignNotification.Create; 
begin 
    inherited Create; 
end; 

procedure TDesignNotification.DesignerClosed(const ADesigner: IDesigner; 
    AGoingDormant: Boolean); 
begin 

end; 

procedure TDesignNotification.HideFormItems(Form : TForm); 
var 
    j, 
    l : Integer; 
    Panel : TPanel; 
    C : TComponent; 
    HideCount : Integer; 

    procedure HideControl(AControl : TControl); 
    begin 
    AControl.Height := 0; // This is necessary because the IDE seems to reset 
    // Visible to True when the Object Inspector is refreshed. 
    AControl.Visible := False; 
    end; 

begin 
    HideCount := 0; 
    for j := 0 to Form.ComponentCount - 1 do begin 
    C := Form.Components[j]; 
    if C is TPanel then begin 
     Panel := TPanel(C); 
     for l := 0 to Panel.ControlCount - 1 do begin 
     if CompareText(Panel.Controls[l].ClassName, 'TDescriptionPane') = 0 then begin 
      HideControl(Panel.Controls[l]); 
      Inc(HideCount); 
     end 
     else 
      if CompareText(Panel.Controls[l].ClassName, 'THotCommands') = 0 then begin 
      HideControl(Panel.Controls[l]); 
      Inc(HideCount); 
      end; 
     if HideCount >= 2 then // we're done 
      exit; 
     end; 
    end; 
    end; 
end; 

procedure TDesignNotification.HideItems; 
var 
    i : Integer; 
    Form : TForm; 
begin 
    for i := 0 to Screen.FormCount - 1 do begin 
    Form := Screen.Forms[i]; 
    if CompareText(Form.ClassName, 'TPropertyInspector') = 0 then begin 
     HideFormItems(Form); 
     Break; 
    end; 
    end; 
end; 

procedure TDesignNotification.DesignerOpened(const ADesigner: IDesigner; 
    AResurrecting: Boolean); 
begin 

end; 

var 
    DestroyCount : Integer; 

destructor TDesignNotification.Destroy; 
begin 
    Inc(DestroyCount); 
    inherited; 
end; 

procedure TDesignNotification.ItemDeleted(const ADesigner: IDesigner; 
    AItem: TPersistent); 
begin 

end; 

procedure TDesignNotification.ItemInserted(const ADesigner: IDesigner; 
    AItem: TPersistent); 
begin 

end; 

procedure TDesignNotification.ItemsModified(const ADesigner: IDesigner); 
begin 

end; 

procedure TDesignNotification.SelectionChanged(const ADesigner: IDesigner; 
    const ASelection: IDesignerSelections); 
var 
    C : TComponent; 
begin 
    // This can get called with ADesigner = Nil 
    if ADesigner = Nil then 
    exit; 
    C := ADesigner.Root; 
    if C <> Nil then begin 
    HideItems; 
    end 
end; 

initialization 
    SetUp; 
finalization 
    if DesignNotification <> Nil then begin 
    UnRegisterDesignNotification(DesignNotification); 
    end; 
end. 
+1

GExperts에 IDE 향상 기능으로 코드를 추가하고 싶습니다. 너는 그렇게하는 것이 괜찮 니? – dummzeuch

+0

@dummzeuch : 예, 좋습니다.코드 정리, btw 주셔서 감사합니다. – MartynA

+0

나는 창을 숨길 수있는 더 깨끗한 방법을 발견했다 : 숨겨진 TPanel을 추가하고 부모를 그 패널에 설정한다. 불행히도 스플리터는 여전히 눈에 띄지 않습니다. 그들의 부모를 바꾸는 것 또한 그 문제를 해결합니다. 그러나 내가 다시 볼 수있게 만들 때 스플리터와 창유리의 순서가 잘못되었습니다. 볼랜드가 스플리터를 구현하는 방식을 싫어합니다. – dummzeuch