Panning and pop-up menus

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
toreba
Newbie
Newbie
Posts: 17
Joined: Thu Aug 07, 2014 12:00 am

Panning and pop-up menus

Post by toreba » Thu Jun 18, 2015 11:14 am

Hi,

With the conventional use of a pop-up menu on the right mouse click event, I can't use the TChart's automatic panning on the right mouse button, not even if I require e.g. [ssCtrl] in the TeeScrollKeyShift property.

I can't run the pan function on the left mouse button without losing the automatic zoom, again, even using TeeScrollKeyShift.

Is it possible to run the pan function through some other combination of keys so that the user does not have to explicitly switch between zoom and pan modes?

Thanks for any advice!

Toreba

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Panning and pop-up menus

Post by Yeray » Thu Jun 18, 2015 3:00 pm

Hello toreba,

This seems to do the trick:

Code: Select all

var DownPos: TPoint;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  DownPos.X:=X;
  DownPos.Y:=Y;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (Button=mbRight) and (DownPos.X = X) and (DownPos.Y = Y) then
    PopupMenu1.Popup(GetClientOrigin.X+Chart1.Left+X, GetClientOrigin.Y+Chart1.Top+Y);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  PopupMenu1.AutoPopup := false;
  Chart1.PopupMenu := PopupMenu1;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

toreba
Newbie
Newbie
Posts: 17
Joined: Thu Aug 07, 2014 12:00 am

Re: Panning and pop-up menus

Post by toreba » Fri Jun 19, 2015 2:52 pm

Yeray,

Yeah, that's neat! Thanks very much!

Regards

Toreba

Post Reply