How to cancel navigation?

I have a form with tabless panel that contains another form. When navigation on parent form is clicked I would like to prompt a user with “Cancel: yes/no” choice in case changes were made to child form and not saved. I am trying this:

// form's "onRecordSelection" event
function nav(){
	if( plugins.dialogs.showQuestionDialog('Confirm','Cancel?','yes','no')==='no'){
		return false}}

If I click “no” the actual navigation doesn’t happen but row number in the navigator changes to next record. Obviously it should stay at same record number.

How can the desired functionality be attained?

returning false on a on record selection doesn’t do anything
Because that is an “after the fact” event so the selection is already changed.

So you just have to set it back to the desired selection.