Return focus to calc sheet [closed]

asked 2013-11-28 10:52:47 +0100

jheath gravatar image

I use the following code to see if the currently active cell is in edit mode (i.e. has an insertion point), and if so "click" the Accept button so that we can modify the cell:

' Check to see if we are in edit mode (with active cursor in the cell)
oAC = ThisComponent.CurrentController.Frame.ComponentWindow.accessibleContext
oACToolbar = oAC.getAccessibleChild(1).accessibleContext
oACSumCancel = oACToolbar.getAccessibleChild(3)
sName = oACSumCancel.AccessibleName
If sName <> "Sum" Then
    ' we are in edit mode, attempt to get out of it or else we can't modify the cell
    oACFunctionAccept = oACToolbar.getAccessibleChild(4)
End If

But when control is returned to the user, the "focus" is still up in the toolbar. Can someone tell me how to get the focus back on the spreadsheet? I tried a selection, but the focus seems to be a different thing than the selection. And if the focus is up in the toolbar, when the user types the arrow keys or Enter, the results aren't what he expects, since they are acting up the toolbar. So how do I set focus back on the spreadsheet?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-10-05 01:35:32.454859


I noticed that one way to change the focus back to the spreadsheet is by typing Esc. So since there aren't any takers for my first question, can anyone tell me how to make my macro "type" an Esc to get the focus back to the spreadsheet?

jheath gravatar imagejheath ( 2013-12-05 12:17:09 +0100 )edit