How to programmatically set absolute record in (added) navigation toolbar control?

I have a form to which I’ve added a navigation toolbar control (i.e. I’m not talking about the navigation toolbar which sits by default in the status bar at the bottom).
I want to set the “absolute” value (i.e. the row number in the recordset underlying the form) of this nav toolbar programmatically. I’ve mri’d the component and its view but can’t seem to see a way to do that.
The box where you find this “absolute” value looks like a text box control, so I imagined it might have some “offset” or “delegated” relationship to the overall nav toolbar control. But if so, I’m having trouble finding how to access and set this value.
PS I’m trying to move the recordset to a given row in the recordset. If there’s another way of doing this I’d be just as happy to do that. Cycling through the whole recordset by going beforeFirst(), next(), next(), next(), next() … does NOT work however. (This means the whole GUI has to be updated each time: ridiculously slow, eventually causes crash, etc.). Nevertheless, the nav toolbar control appears to be able to access some mechanism enabling a specific row in the recordset to be chosen … so maybe there’s a way to get a hook into that without using a nav toolbar control (?).

Biblio_Form_Dispatch.odt (23.8 KB)

1 Like


Just to translate this and show how you can navigate from a list box selection (assuming its entries mirror the number and order of records in the form’s underlying recordset):

desktop = XSCRIPTCONTEXT.getDesktop()
component = desktop.getCurrentComponent() 
my_form = component.DrawPage.Forms[0]
form_controller = component.CurrentController.getFormController(my_form)

list_index = listbox.SelectedItems[0]

from import MoveAbsolute
from import NamedValue
nv = NamedValue('Position', list_index + 1)
form_controller.FormOperations.executeWithArguments(MoveAbsolute, [nv])


component = XSCRIPTCONTEXT.getDocument()

Thanks… but this doesn’t seem to be the case in my setup

desktop = XSCRIPTCONTEXT.getDesktop()
component = desktop.getCurrentComponent() 
doc = XSCRIPTCONTEXT.getDocument()'{doc}') #'{component}') # implementationName=SwXTextDocument'doc == component? {doc == component}') # False