is there a way to disable the PgUp/PgDn Keys on a form? Please note that I don't want to change the underlying filter, I just want to prevent users from accidentally changing records...
I'm not quite sure of what you want to do here. Do you want to stop the user from moving to the previous or the next record?
If so, why not simply set the filter onto a single record and disable inserting of new record?
If you don't want to do it that way, then I don't know of a way to disable keys, but you can stop the user moving to the previous and next records by manually dealing with the OnFindRecord and OnNextRecord triggers. Maybe it's simply the OnNextRecord trigger, I can't quite remember at the moment.
I have a code snippet somewhere that does this.
EDIT: I don't have the code example at hand, so I just did a quick test. If OnNextRecord is blank, a simple EXIT(Steps) will stop the user moving it seems. It does not stop the user clicking on the first and last record buttons however. You would have to deal with that in the OnFindRecord trigger.
EDIT: A simple EXIT(TRUE) in OnFindRecord does the trick, but I did a GET in on open form to set the record.
You will have to have a play with this to get it to do exactly what you want.
Comments
however, as I said, I don't really want to change the filter, I just want to disable the keys - is that possible?
The reason is: The scroll wheel of the mouse does PgUp/PgDn keys, and I want to prevent users from accidentally changing records.
If so, why not simply set the filter onto a single record and disable inserting of new record?
If you don't want to do it that way, then I don't know of a way to disable keys, but you can stop the user moving to the previous and next records by manually dealing with the OnFindRecord and OnNextRecord triggers. Maybe it's simply the OnNextRecord trigger, I can't quite remember at the moment.
I have a code snippet somewhere that does this.
EDIT: I don't have the code example at hand, so I just did a quick test. If OnNextRecord is blank, a simple EXIT(Steps) will stop the user moving it seems. It does not stop the user clicking on the first and last record buttons however. You would have to deal with that in the OnFindRecord trigger.
EDIT: A simple EXIT(TRUE) in OnFindRecord does the trick, but I did a GET in on open form to set the record.
You will have to have a play with this to get it to do exactly what you want.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n