Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#3

Re: Doppelclick in einem Panel der Statusbar erkennen

  Alt 16. Mai 2008, 11:42
...oder indem du dieses DblClick Ereignis nachrüstest:


Delphi-Quellcode:
unit MyStatusBar;

interface


uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls;

const
  WM_PANELDBLCLICK = WM_USER + $501;

type
  TPanelClickEvent = procedure(Sender: TObject;
    PanelIndex: Integer) of object;


  TMyStatusBar = class(TStatusBar)
  private
    FOnPanelDblClick: TPanelClickEvent;
    procedure CNNotify(var Message: TWMNotify);
      message CN_NOTIFY;
    procedure WMPanelDblClick(var Message: TMessage);
      message WM_PANELDBLCLICK;
  published
    property OnPanelDblClick: TPanelClickEvent
      read FOnPanelDblClick
      write FOnPanelDblClick;
  end;

procedure Register;

implementation

uses
  CommCtrl;

procedure Register;
begin
  RegisterComponents('Misc Components', [TMyStatusBar]);
end;

{ TMyStatusBar } 


procedure TMyStatusBar.CNNotify(var Message: TWMNotify);
begin
  inherited;
  with Message do
  begin
    case NMHdr^.code of
      NM_DBLCLK:
        with PNMMouse(NMHdr)^ do
        begin
          Result := 1;
          PostMessage(Handle, WM_PANELDBLCLICK, dwItemSpec, 0);
        end;
    end;
  end;
end;

procedure TMyStatusBar.WMPanelDblClick(var Message: TMessage);
begin
  inherited;
  if Assigned(FOnPanelDblClick) then
    FOnPanelDblClick(Self, Message.wParam);
end;

end.
Thomas
  Mit Zitat antworten Zitat