Hi Andrew,
I found the same problem with a simple control Button. You have to set focus again on the document window (sort of).
Just add this instruction at end of your macro:
  oFrame.ContainerWindow.setFocus

By the way, I did not know the .uno:SetInputMode trick !
______
Bernard


Message de Andrew Douglas Pitonyak  date 2008-10-28 04:36 :
I was recently asked how to solve a "simple" problem.

A checkbox in a Calc document calls a macro when it is "clicked".

I want the macro to select a cell such that the cell is in input mode.

Ignoring the checkbox, I can use code similar to the following:

Sub CellSelectOne
 Dim oCell
 Dim oSheet

 REM Get the first sheet.
 oSheet = ThisComponent.getSheets().getByIndex(0)
 REM Get cell A2
 oCell = oSheet.GetCellbyPosition( 0, 1 )
 REM Move the selection to cell A2
 ThisComponent.CurrentController.Select(oCell)

 Dim oFrame
 Dim oDisp

 oFrame = ThisComponent.CurrentController.Frame
 oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
 oDisp.executeDispatch(oFrame, ".uno:SetInputMode", "", 0, Array()) End Sub

I even tried this:

 Dim args2(0) as new com.sun.star.beans.PropertyValue
 args2(0).Name = "ToPoint"
 args2(0).Value = "$G$4"
 oDisp.executeDispatch(oFrame, ".uno:GoToCell", "", 0, args2())

When the macro returns, the checkbox still has focus.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to