Stopping focus moving to controls

As a workaround I’ve put the following code in the focusGained event of the control I don’t want to receive the focus:

if event.oppositeComponent.name == "previousControlName":
	event.source.transferFocus()
elif event.oppositeComponent.name == "followingControlName":
	event.source.transferFocusBackward()