Commit 04d6ec05 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

WebForm.Shortcuts is a new property that allows to declare a list of shortcuts...

WebForm.Shortcuts is a new property that allows to declare a list of shortcuts the browser won't see.

[GB.WEB.GUI]
* BUG: Keyboard events work again.
* NEW: WebForm.Shortcuts is a new property that allows to declare a list of shortcuts the browser won't see.
parent a981bb37
Pipeline #359671883 passed with stage
in 26 minutes and 40 seconds
......@@ -4,6 +4,7 @@
#MoveScaled(0,0,138,91)
Height = "100%"
Arrangement = Arrange.Vertical
Shortcuts = ["F12", "F11"]
{ WebMenu1 WebMenu
Text = ("WebMenu1")
{ WebMenu3 WebMenu
......
......@@ -11,7 +11,7 @@ Class _DefaultStock
Public Const _IsForm As Boolean = True
Public Const _HiddenControls As String = "WebControl,WebForm,Timer,WebMenu"
Public Const _Properties As String = "*,Title,Resizable,Persistent"
Public Const _Properties As String = "*,Title,Resizable,Persistent,Shortcuts"
Public Const _DefaultEvent As String = "Open"
Static Property Debug As Boolean Use $bDebug
......@@ -57,6 +57,8 @@ Property Read PopupParent As WebControl
'' Closing a non-persistent form automatically destroys it.
Property Persistent As Boolean
Property Shortcuts As String[]
Static Public _DisableRefresh As Integer
Static Public _HasRefresh As Boolean
Static Public _InMessage As Integer
......@@ -100,6 +102,8 @@ Private $aJavascriptFiles As String[]
Private $aJavascriptExternFiles As String[]
Private $aHeaders As String[]
Private $aShortcuts As String[]
'Private $bOpened As Boolean
Static Public Sub _init()
......@@ -1404,20 +1408,29 @@ Private Sub FindShortcut(hParent As WebContainer, cShortcut As Collection)
End
Private Sub DisableShortcuts()
Private Sub DisableShortcuts()
Dim cShortcut As Collection
Dim sShortcut As String
cShortcut = New Collection
FindShortcut($hMenuBar, cShortcut)
If $aShortcuts Then
For Each sShortcut In $aShortcuts
sShortcut = Trim(sShortcut)
If Not sShortcut Then Continue
cShortcut[sShortcut] = True
Next
Endif
If cShortcut.Count = 0 Then Return
_AddJavascript("gw.shortcuts = " & JS(cShortcut))
End
Private Sub TriggerShortcut(hParent As WebContainer, sShortcut As String) As Boolean
Dim hChild As WebControl
......@@ -1453,3 +1466,16 @@ Public Sub _RaiseKeyPress(cEvent As Variant)
TriggerShortcut($hMenuBar, String.UCase(sShortcut))
End
Private Function Shortcuts_Read() As String[]
If Not $aShortcuts Then $aShortcuts = New String[]
Return $aShortcuts
End
Private Sub Shortcuts_Write(Value As String[])
$aShortcuts = Value
End
......@@ -1641,3 +1641,4 @@ gw = {
}
}
document.onkeydown = gw.onkeydown;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment