In a Uniface 10 desktop form, Ctrl+A is bound to ^ACCEPT. Users from every other Windows program expect "select all" or nothing at all; what they get is a closed form. While testing a customer app I lost a half-filled form that way more than once. Two component-level triggers fix it, and the same pair adds a "you have unsaved input" question on close.
Tested with Rocket Uniface 10.4.03 Community Edition (10.4.03.021) on Windows, November 2026.
accept and quit
-
trigger acceptfires on^ACCEPT(Ctrl+A) oractivate "FORM".accept(). If it completes successfully, the form ends. -
trigger quitfires on^QUIT, which in this app is what the Close button sends, and when the window is closed.
In both, return -1 keeps the form open. That is all it takes:
operation exec
call SET_LABELS
call SET_RIGHTS
$fieldproperties(F_TAG.QCU_DMY) = "DblClk=Detail"
call DO_CLEAR
edit
end
trigger accept
call DO_SAVE
return -1
end
trigger quit
call CHECK_UNSAVED
return $status
end
Ctrl+A now saves the new customer and the form stays open for the next one. DO_SAVE is the same entry the Save button calls, so there is only one code path.
Unsaved input without a database entity
Forms that edit database occurrences can ask Uniface whether something was modified ($instancedbmod). This quick entry form works with a non-database entity: the user types, a service writes the data. So the form keeps its own snapshot of the field values in a component variable (cSnap, declared as string cSnap) and compares it on close:
entry GET_SNAP
params
string pSnap : OUT
endparams
pSnap = $concat(F_LAST.QCU_DMY, "|", F_FIRST.QCU_DMY, "|")
pSnap = $concat(pSnap, F_EMAIL.QCU_DMY, "|")
pSnap = $concat(pSnap, F_PHONE.QCU_DMY, "|", F_STREET.QCU_DMY, "|")
pSnap = $concat(pSnap, F_POSTAL.QCU_DMY, "|", F_CITY.QCU_DMY, "|")
pSnap = $concat(pSnap, F_TAG.QCU_DMY)
return 0
end
entry CHECK_UNSAVED
variables
string vSnap
endvariables
call GET_SNAP(vSnap)
if (vSnap != $cSnap$)
askmess/question "The new customer has not been saved. Close anyway?~Close", "Yes,No"
if ($status != 1)
return -1
endif
endif
return 0
end
The snapshot is taken whenever the form is clean, after a save or a clear:
entry CLEAR_FIELDS
variables
string vSnap
endvariables
F_LAST.QCU_DMY = ""
F_FIRST.QCU_DMY = ""
F_EMAIL.QCU_DMY = ""
F_PHONE.QCU_DMY = ""
F_STREET.QCU_DMY = ""
F_POSTAL.QCU_DMY = ""
F_CITY.QCU_DMY = ""
F_TAG.QCU_DMY = ""
if (F_COUNTRY.QCU_DMY = "")
F_COUNTRY.QCU_DMY = "DE"
endif
$cSim$ = 0
call GET_SNAP(vSnap)
$cSnap$ = vSnap
return 0
end
Note the $concat calls of at most five arguments: with six, the compiler reports error 1000 "Wrong number of arguments".
How it behaves
- Typing a customer and pressing Ctrl+A saves it; if similar customers exist, the save asks first.
- Typing and pressing Close asks "The new customer has not been saved. Close anyway?"; No keeps the form and the input.
- Closing an empty or just saved form asks nothing.
The same pattern is used in two more forms of the app: in the follow-up form Ctrl+A adds the follow-up, in a data completion form it means "save and next customer".
Summary
-
trigger acceptwithreturn -1turns Ctrl+A into a shortcut of your choice. -
trigger quitwithreturn -1can stop a close; ask withaskmess/questionfirst. - For forms without database occurrences, compare a snapshot of the fields.
- Tell users about the shortcut on the form itself; this one says "Ctrl+A saves." next to the fields.
Top comments (0)