Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello,

It appears the problem you are having is because your primary form contains the table control and the sub form has just the text field - just the opposite of your link.

Now in using the table control on the primary form, certain actions will occur with different key strokes such as using the Tab or Enter keys. These will take you to another field within the control, another record within the control or to another control depending upon where in the control you are and which key you are using. So all being said, the table control was not designed to do what you are attempting to do, at least not easily.

So it is easy enough to have your form and simply, when you have selected the proper record in the table control, mouse click the text field to give it control. However with you comment on ...being able to navigate the records quickly... it appears you want to get there with a key entry.

To override the internal Tab, Enter or other possible key functions can be problematic and it would be easier to use a key combination such as Ctrl & Tab to change focus to the text field.

First change your form. No sub form needed. Move the TextField over to MainForm. You can delete the sub form. Remove any existing Event links to macros you may have - not needed.

You will need this macro:

Sub Main
    Dim oForm, oCtrlr, oField As Object
    oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
    oCtrlr = ThisComponent.getCurrentController()
    oField = main_frm.getByName("TextField")
    oCtrlr.getControl(oField).setFocus()
End Sub

The names remain the same as before so no changes needed there. Now attach this to a custom key combination as mentioned - from menu Tools->Customize. Set up on Keyboard tab.

Once set you will be able to change focus from a table control field to the text field and from the text field back to the table control with the Tab key.