Selection can't be cancelled by ESC

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
nxuser
Newbie
Newbie
Posts: 3
Joined: Fri Jan 04, 2019 12:00 am

Selection can't be cancelled by ESC

Post by nxuser » Wed Apr 19, 2023 1:35 am

On Windows, the standard behaviour of selection, dragging etc using the mouse is to cancel the operation if ESC is pressed.

This does not happen if I start creating a selection rectangle in a TChart. Pressing ESC does not cancel the operation.

Marc
Site Admin
Site Admin
Posts: 1203
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Selection can't be cancelled by ESC

Post by Marc » Thu Apr 20, 2023 7:16 am

Hello,

In general, if mouse interacttion with the chart is being used for other than just zoom/scroll, then Chart.CancelMouse can be set to deactivate a zoom-underway.

Ref. https://steema.com/docs/teechart/vclfmx ... Mouse.html

Code: Select all

// Tell the chart to do zoom or scroll as default:
Chart1.CancelMouse:=False;
Regards,
Marc
Steema Support

nxuser
Newbie
Newbie
Posts: 3
Joined: Fri Jan 04, 2019 12:00 am

Re: Selection can't be cancelled by ESC

Post by nxuser » Sat Apr 22, 2023 3:32 am

My point is simply that the component does not adhere to standard Windows input behaviour in its default configuration.

Are you saying I should detect key presses manually during a rectangle selection, and set CancelMouse if ESC is pressed on the keyboard?

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

Re: Selection can't be cancelled by ESC

Post by Yeray » Fri May 12, 2023 6:31 am

Hello,

You could use the OnKeyDown event to cancel the Zoom and Panning actions. Ie:

Code: Select all

procedure TForm1.Chart1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=TeeKey_Escape then
  begin
    Chart1.Zoom.Active:=False;
    Chart1.Panning.Active:=False;
    Chart1.Draw;
  end;
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

Post Reply