Lewy,
Um, Ctrl+Z is already coded for that purpose in the UI, but you can add that to a form by adding code along these lines to the form's keyPhysical event:
Code:
method keyPhysical(var eventInfo KeyEvent)
var
strTable String
endVar
if eventInfo.isPreFilter() then
strTable = active.getProperty( "Tablename" )
if strTable.isAssigned() AND strTable <> "" AND
eventInfo.isControlKeyDown() then
if eventInfo.vChar() = "F" then
disableDefault
active.menuAction( menuRecordLocateValue )
endIf
endIf
endIf
endMethod
Now, you'll notice that this is more detailed than what's usually recommended. Here's why:
1. MenuRecordLocateValue (and other data menu actions) are only applicable when the active object (the one with focus) is actually bound to a table. For example, if you trigger this menuAction when focus is on a button, you'll receive an error. This code works with that by ensuring the active object is data aware, e.g. it has a Tablename property and that property actually has a value.
2. By default, buttons receive focus when clicked; they become the active object. If you're using buttons to trigger this sort of result, you need to set the button's Tab Stop property to FALSE; otherwise, you'll get the error mentioned earlier.
3. While I dislike using disableDefault as a general rule, it's useful in this case. In general, it's preferable to use eventInfo.setErrorCode( userError ) instead. (Reasons are far too complex to go into here and there are different viewpoints in the community.)
4. As a general rule, I do not normally use compund IF statements in ObjectPAL (for Paradox doesn't use short-circuit evaluation and unassigned values will raise errors that are difficult to debug). I used one in this case because I could guarantee that all conditions in the compound evaluation would have values. this needs more extensive discussion, but please use compound evaluations with care.
5. Also, you'll notice that I remapped Ctrl+F for this action, since Ctrl+Z is provided by default.
Hope this helps...
-- Lance