2013-02-16 5 views
5

TActionMainMenuBar에 자식 항목이없는 페인팅 root elemetnts에 버그가 있습니다.
빌드 메뉴를 TActionMainMenuBar가와, 여기에 몇 가지 작업을 추가 :TActionMainMenuBar에 대한 문제 해결 항목이 선택 취소되지 않은 버그

file | options | help 
- New 
- Open 
- Save 
    -Exit 

지정을 모든 작업에 하나의 빈 방법

델파이 XE2는/w7-32bit **

재현하는 방법을 사용하여

procedure TfrmMain.ActionExecute(Sender: TObject); 
begin 
// 
end; 

이제 응용 프로그램을 실행하고 옵션 또는 도움말 요소를 클릭하십시오.
지금 양식을 클릭하지만 메뉴 요소가 계속 눌려 있습니다!

모든 대안이 있습니까?

upd : 스크린 샷을보고, 메뉴 요소가 아래쪽이지만 마우스 커서가 메뉴에없고 자동 검사가 거짓이며 검사도 false입니다.
이 같은 사용자 정의 클래스 작성 : 내 해결되는
여기 enter image description here
양식에 어떤 컬러 맵이 아니며, 관리자의 스타일은 플랫폼의 디폴트 여기

+0

Delphi 2009에서 아무런 문제가 보이지 않거나 재현 할 수 없습니다. –

+0

@AndreasRejbrand에 빈 메소드가 지정 되었습니까? 컴파일 된 exe를 보내주십시오, 아마도 XE2에 회귀가 있습니다. – utmost

+0

XE2를 재현 할 수 있습니까? – davea

답변

1

입니다 ...


type 
    TFastThemedButton = class(TThemedMenuButton) 
    protected 
    procedure DrawBackground(var PaintRect: TRect); override; 
end; 


procedure TFastThemedButton.DrawBackground(var PaintRect: TRect); 
const 
    MenuStates: array[Boolean {MouseInControl}, Boolean {Selected}] of TThemedMenu = 
    ((tmMenuBarItemNormal, tmMenuBarItemPushed), (tmMenuBarItemHot, tmMenuBarItemPushed)); 
var 
    BannerRect: TRect; 
    StartCol, EndCol: TColor; 
begin 
    Canvas.Brush.Color := ActionBar.ColorMap.Color; 
    Canvas.Font := ActionBar.Font; 
    StyleServices.DrawElement(Canvas.Handle, StyleServices.GetElementDetails(MenuStates[MouseInControl, (State=bsDown)]), PaintRect); 
end;

TActionMainMenuBar.OnGetControlClass이 간단한 코드를 추가하고 버그를 설정합니다. actionclients tag = -100


procedure TfrmActions.ActionMainMenuBar1GetControlClass(Sender: TCustomActionBar; AnItem: TActionClient; var ControlClass: TCustomActionControlClass); 
begin 
    if ControlClass.InheritsFrom(TCustomMenuButton) and then 
    begin 
    if (AnItem.Tag =-100) and (ControlClass = TThemedMenuButton) then 
     ControlClass := TFastThemedButton; 
    end; 
end;

은 물론, 지금은 -100 태그 모든 루트 항목, 우리는 내가 메뉴와 모든 형태에 MainMenu.RecreateControls으로 이벤트 MainMenuExitMenuLoop을 사용하고

0

원하는대로 작동합니다. 지금까지는 메뉴 항목에서 걸린 선택을 제거합니다.