Switch focus back to editor from editor view part

This issue is sort of a follow-up to my question about updating the target segment of a TU from a custom editor view part (https://community.sdl.com/developers/language-developers/f/57/t/5133)

I have a view part that contains a DataGridView control.  When the user navigates to a segment in the translation editor, the data grid gets populated with some data corresponding to the current segment.  When that happens, the focus gets automatically moved to my view part, and specifically to the data grid, which is in fact the desired behavior.

However the problem is that after using the data grid to manipulate the related data and using an event in the data grid to update the target segment using UpdateSegmentPair, the focus stays on the data grid in my view part, but I would like to move the focus back to the translation editor.  Unfortunately I can't see a direct way to do that.  Right now I'm using SendKeys("{TAB}") several times, but it is very buggy and only works some of the time.

Is there a way to directly place the focus back on the translation editor from code?

Parents Reply
  • Thanks Patrick, brilliant, that seems to work for me as well (although being miles above my non-programmer head).

    I do not only want to move focus back but need to go to a specific segment so my work current workaround was SendKeys.Send("{F6}") after SetActiveSegmentPair, but for obvious reasons that is far from ideal (default setting means that F6 is toggling source/target, but I guess the user could change F6 to mean virtually anything).

    Question: Does someone know if it is possible to check the current Studio keyboard shortcuts somehow?

    Romulus, as you may already have discovered SetActiveSegmentPair will only make the segment in question active - it will not move focus/cursor there.
Children
No Data