User Tools

Site Tools


guides:tutorials:interrupt

Table of Contents

Interrupting of a long redraw operation

Documentation | Tutorials | Interrupt

In DK11 we decided to not implement Esc button hijacking. Such operation done on a control side is not reliable if control is embedded into other control or other control got to focus. So now implement this requires a bit of coding to call GIS.Interrupt method upon pressing Esc key on main form context. Of course, you can implement an alternative method of interrupting for example upon clicking mouse, etc.

In opposite to map drawing other long-term operation raise BusyEvent (VCL|FMX|WinForms|JAVA), which can be intercepted to show progress bar and allow interruption. Such event exits also on a layer level.

VCL

Ensure that TMainForm.KeyPreview is True.

Uses TGIS_ViewerWnd.Interrupt method

procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_ESCAPE then
    GIS.Interrupt ;
end;

FMX

Uses TGIS_ViewerWnd.Interrupt method

procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
  var KeyChar: Char; Shift: TShiftState);
begin
  if key =  27 then
    GIS.Interrupt ;
end;

WinForms

Ensure that MainForm.KeyPreview is True.

Uses TGIS_ViewerWnd.Interrupt method

private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
   if (e.KeyCode == Keys.Escape)
   {
      GIS.Interrupt();
   }
}
2019/09/27 13:15