add TabPressedEventHandler.cs
This commit is contained in:
parent
235735fb3a
commit
9cbb510c48
4 changed files with 20 additions and 3 deletions
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2022 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Browser.Contracts.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event handler used to indicate that the user pressed the tab key to move the focus forward or backward.
|
||||
/// </summary>
|
||||
public delegate void TabPressedEventHandler(bool forward);
|
||||
}
|
|
@ -57,6 +57,7 @@
|
|||
<Compile Include="Events\DownloadEventArgs.cs" />
|
||||
<Compile Include="Events\DownloadFinishedCallback.cs" />
|
||||
<Compile Include="Events\DownloadRequestedEventHandler.cs" />
|
||||
<Compile Include="Events\TabPressedEventHandler.cs" />
|
||||
<Compile Include="Events\LoseFocusRequestedEventHandler.cs" />
|
||||
<Compile Include="Events\SessionIdentifierDetectedEventHandler.cs" />
|
||||
<Compile Include="Events\TerminationRequestedEventHandler.cs" />
|
||||
|
|
|
@ -702,7 +702,7 @@ namespace SafeExamBrowser.Browser
|
|||
}
|
||||
}
|
||||
|
||||
private void TabPressed(object sender, bool shiftPressed)
|
||||
private void TabPressed(bool shiftPressed)
|
||||
{
|
||||
this.Control.ExecuteJavascript("document.activeElement.tagName", result =>
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using SafeExamBrowser.Browser.Contracts.Events;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Browser.Handlers
|
||||
|
@ -21,7 +22,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
|||
internal event ActionRequestedEventHandler ZoomOutRequested;
|
||||
internal event ActionRequestedEventHandler ZoomResetRequested;
|
||||
internal event ActionRequestedEventHandler FocusAddressBarRequested;
|
||||
internal event System.EventHandler<bool> TabPressed;
|
||||
internal event TabPressedEventHandler TabPressed;
|
||||
|
||||
private int? currentKeyDown = null;
|
||||
|
||||
|
@ -64,7 +65,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
|||
|
||||
if (keyCode == (int)Keys.Tab && keyCode == currentKeyDown)
|
||||
{
|
||||
TabPressed?.Invoke(this, shift);
|
||||
TabPressed?.Invoke(shift);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue