Skip to content

Commit

Permalink
try to catch escape key when cell is in editing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
delahaye-4D committed Nov 19, 2024
1 parent 9cc1699 commit 06a8e67
Show file tree
Hide file tree
Showing 20 changed files with 309 additions and 236 deletions.
2 changes: 2 additions & 0 deletions Project/Sources/Forms/%25report/form.4DForm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"markerFooter": 110,
"events": [
"onLoad",
"onLosingFocus",
"onGettingFocus",
"onUnload",
"onTimer",
"onBoundVariableChange"
Expand Down
42 changes: 42 additions & 0 deletions Project/Sources/Forms/%25report/method.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,48 @@ Case of

//

: ($form_event.code=On Getting Focus:K2:7)


Case of

: (ob_area=Null:C1517)

: (ob_area.window=Null:C1517)

: ($form_event.objectName="nqr") // the listbox

If (Num:C11($form_event.column)>1)

CALL FORM:C1391(Current form window:C827; "do_enable_object"; "trap_escape"; True:C214)

End if


End case


: ($form_event.code=On Losing Focus:K2:8)

Case of

: (ob_area=Null:C1517)

: (ob_area.window=Null:C1517)

: ($form_event.objectName="nqr") // the listbox

If (Num:C11($form_event.column)>1)


CALL FORM:C1391(Current form window:C827; "do_enable_object"; "trap_escape"; False:C215)


End if

End case


//______________________________________________________
: ($form_event.code=On Bound Variable Change:K2:52) // Area update event

Expand Down
20 changes: 20 additions & 0 deletions Project/Sources/Forms/NQR/ObjectMethods/trap_escape.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

//GOTO OBJECT(*; "myQR")
//GOTO OBJECT(*; "")

//SET TIMER(-1)

//EXECUTE METHOD IN SUBFORM("myQR"; "do_goto_object"; *; "nqr")

//report_AFTER_EDIT

//var $cell : Pointer

//$cell:=OBJECT Get pointer(Object with focus)
//$name:=OBJECT Get name(Object with focus)

//FORM GET OBJECTS($_ob; $_var; $_page; Form current page)


//OBJECT SET ENTERABLE($cell->; False)
//ob_area.cellEdition:=False
42 changes: 38 additions & 4 deletions Project/Sources/Forms/NQR/form.4DForm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"top": 521,
"left": 6,
"width": 744,
"height": 146,
"height": 246,
"visibility": "hidden",
"sizingY": "move",
"fill": "#FFFF00",
Expand Down Expand Up @@ -585,6 +585,40 @@
"onLongClick"
],
"fontSize": 12
},
"trap_escape": {
"type": "button",
"top": 688,
"left": 591,
"width": 150,
"height": 34,
"sizingY": "move",
"shortcutKey": "[Esc]",
"shortcutAccel": false,
"text": "trap-escape",
"focusable": false,
"events": [
"onClick"
],
"fontSize": 12,
"shortcutControl": false,
"shortcutShift": false,
"shortcutAlt": false,
"visibility": "visible",
"sizingX": "fixed",
"method": "ObjectMethods/trap_escape.4dm"
},
".devWarning2": {
"type": "text",
"top": 679,
"left": 190,
"width": 323,
"height": 66,
"visibility": "hidden",
"sizingY": "move",
"stroke": "#EE0000",
"fontWeight": "bold",
"text": "\"In tool mode, the 'escape' key closes the window while we are in cell editing mode. This button allows capturing the 'escape' key press to exit edit mode without closing the window.\""
}
}
},
Expand Down Expand Up @@ -757,15 +791,16 @@
"version": "1",
"kind": "form"
},
"geometryStamp": 43,
"geometryStamp": 159,
"editor": {
"activeView": "fieldList",
"activeView": "Area",
"defaultView": "Toolbar",
"views": {
"Toolbar": {
"visible": false
},
"fieldList": {
"visible": false,
"objects": [
"settings.dial"
]
Expand Down Expand Up @@ -817,7 +852,6 @@
]
},
"Area": {
"visible": false,
"objects": [
"myQR"
]
Expand Down
2 changes: 2 additions & 0 deletions Project/Sources/Forms/NQR/method.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Case of

COMPILER_NQR

ob_area.window:=Current form window:C827

//*******************************************************
//UNAVALAIBLE FEATURES
OBJECT SET VISIBLE:C603(*; "toolbar.opened.sep.4"; <>Boo_debug)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
C_LONGINT:C283($Lon_bottom;$Lon_height;$Lon_left;$Lon_right;$Lon_top)

CALL FORM:C1391(Current form window:C827;"NQR_TOOLBAR";"tool.templates")

If (OBJECT Get visible:C1075(*;"tool.selected"))
var $left; $top; $right; $bottom; $height : Integer

CALL FORM:C1391(Current form window:C827; "NQR_TOOLBAR"; "tool.templates")

If (OBJECT Get visible:C1075(*; "tool.selected"))

OBJECT SET VISIBLE:C603(*;"tool.selected";False:C215)
OBJECT SET VISIBLE:C603(*; "tool.selected"; False:C215)

Else

OBJECT GET COORDINATES:C663(*;OBJECT Get name:C1087(Object current:K67:2);$Lon_left;$Lon_top;$Lon_right;$Lon_bottom)
$Lon_height:=$Lon_bottom-$Lon_top
OBJECT GET COORDINATES:C663(*; OBJECT Get name:C1087(Object current:K67:2); $left; $top; $right; $bottom)
$height:=$bottom-$top

OBJECT SET COORDINATES:C1248(*;"tool.selected";$Lon_left-3;$Lon_top-5;$Lon_right+3;$Lon_bottom)
OBJECT SET COORDINATES:C1248(*; "tool.selected"; $left-3; $top-5; $right+3; $bottom)

OBJECT SET VISIBLE:C603(*;"tool.selected";True:C214)
OBJECT SET VISIBLE:C603(*; "tool.selected"; True:C214)

End if
27 changes: 10 additions & 17 deletions Project/Sources/Methods/00_OPEN_WIZARD.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,12 @@ $method_name : Text



If (False:C215)
C_TEXT:C284(00_OPEN_WIZARD; $1)
End if

// ----------------------------------------------------
// Initialisations
$count_parameters:=Count parameters:C259

If ($count_parameters>=1)

$entry_point:=$1

End if


// ----------------------------------------------------
Case of
Expand Down Expand Up @@ -89,41 +82,41 @@ Case of
$menu_bar:=Create menu:C408
$menu_edit:=Create menu:C408

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemUndo"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemUndo"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Undo action:K59:16)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "Z"; Command key mask:K16:1)

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuRedo"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuRedo"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Redo action:K59:17)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "Z"; Shift key mask:K16:3)

APPEND MENU ITEM:C411($menu_edit; "-")

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemCut"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemCut"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Cut action:K59:18)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "X"; Command key mask:K16:1)

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemCopy"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemCopy"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Copy action:K59:19)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "C"; Command key mask:K16:1)

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemPaste"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemPaste"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Paste action:K59:20)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "V"; Command key mask:K16:1)

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemClear"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemClear"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Clear action:K59:21)

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemSelectAll"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemSelectAll"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Select all action:K59:22)
SET MENU ITEM SHORTCUT:C423($menu_edit; -1; "A"; Command key mask:K16:1)

APPEND MENU ITEM:C411($menu_edit; "(-")

APPEND MENU ITEM:C411($menu_edit; Get localized string:C991("CommonMenuItemShowClipboard"))
APPEND MENU ITEM:C411($menu_edit; Localized string:C991("CommonMenuItemShowClipboard"))
SET MENU ITEM PROPERTY:C973($menu_edit; -1; Associated standard action name:K28:8; _o_Show clipboard action:K59:23)

APPEND MENU ITEM:C411($menu_bar; Get localized string:C991("CommonMenuEdit"); $menu_edit)
APPEND MENU ITEM:C411($menu_bar; Localized string:C991("CommonMenuEdit"); $menu_edit)
RELEASE MENU:C978($menu_edit)

SET MENU BAR:C67($menu_bar)
Expand Down
10 changes: 1 addition & 9 deletions Project/Sources/Methods/COMPILER_NQR.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,20 @@

var <>Boo_debug : Boolean

//_O_C_BOOLEAN(<>Boo_debug)

// ===============================================
// DON'T RENAME THESE VARIABLES LINKED TO C++ CODE
// ===============================================
var C_QR_MASTERTABLE : Integer
var C_QR_INITBLOB : Blob
var C_QR_INITPATH : Text
var QR_area : Integer
var C_QR_ONCOMMANDFORMULA : Object

//_O_C_LONGINT(C_QR_MASTERTABLE)
//_O_C_BLOB(C_QR_INITBLOB)
//_O_C_TEXT(C_QR_INITPATH)
//_O_C_LONGINT(QR_area)
//_O_C_OBJECT(C_QR_ONCOMMANDFORMULA)
var QR_area : Integer

// ===============================================

var ob_dialog : Object

//_O_C_OBJECT(ob_dialog)

// ----------------------------------------------------
// Initialisations
Expand Down
4 changes: 0 additions & 4 deletions Project/Sources/Methods/COMPILER_TEMPO.4dm

This file was deleted.

1 change: 1 addition & 0 deletions Project/Sources/Methods/COMPILER_report.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var Form_C_UseVirtualStructure : Integer


// ===============================================

var ob_dialog; ob_area : Object


Expand Down
35 changes: 17 additions & 18 deletions Project/Sources/Methods/NQR_CLOSE.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@
//
// ----------------------------------------------------
// Declarations
C_LONGINT:C283($Lon_parameters)
C_OBJECT:C1216($Obj_message)
var $count_parameters : Integer
var $message : Object

// ----------------------------------------------------
// Initialisations
$Lon_parameters:=Count parameters:C259
$count_parameters:=Count parameters:C259

If (Asserted:C1132($Lon_parameters>=0; "Missing parameter"))
If (Asserted:C1132($count_parameters>=0; "Missing parameter"))

// NO PARAMETERS REQUIRED
$Obj_message:=New object:C1471(\
"src"; "quit")
$message:=New object:C1471("src"; "quit")

// Optional parameters
If ($Lon_parameters>=1)
If ($count_parameters>=1)

// <NONE>

Expand All @@ -46,30 +45,30 @@ If (Bool:C1537(ob_area.modified))

If (Length:C16(C_QR_INITPATH)>0)

$Obj_message.message:=Get localized string:C991("DoYouWantToSaveChangesInThisDocument")
$message.message:=Localized string:C991("DoYouWantToSaveChangesInThisDocument")

$Obj_message.checkbox:=True:C214
$Obj_message.checkboxLabel:=Get localized string:C991("SaveInNewDocument")
$message.checkbox:=True:C214
$message.checkboxLabel:=Localized string:C991("SaveInNewDocument")

Else

$Obj_message.message:=Get localized string:C991("doYouWantToSaveChanges")
$message.message:=Localized string:C991("doYouWantToSaveChanges")

$Obj_message.checkbox:=False:C215
$message.checkbox:=False:C215

End if

$Obj_message.doLabel:=Get localized string:C991("save")
$Obj_message.cancelLabel:=Get localized string:C991("cancel")
$Obj_message.forgetLabel:=Get localized string:C991("doNotSave")
$message.doLabel:=Localized string:C991("save")
$message.cancelLabel:=Localized string:C991("cancel")
$message.forgetLabel:=Localized string:C991("doNotSave")

mess_DISPLAY($Obj_message)
mess_DISPLAY($message)

Else

$Obj_message.action:="none"
$message.action:="none"

NQR_DO_IT($Obj_message)
NQR_DO_IT($message)

End if

Expand Down
Loading

0 comments on commit 06a8e67

Please sign in to comment.