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

Thanks!

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 com.sun.star.form.runtime.FormFeature import MoveAbsolute
from com.sun.star.beans import NamedValue
nv = NamedValue('Position', list_index + 1)
form_controller.FormOperations.executeWithArguments(MoveAbsolute, [nv])

Hallo

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()
logger.info(f'{doc}') # implementationName=com.sun.star.comp.dba.ODatabaseDocument
logger.info(f'{component}') # implementationName=SwXTextDocument
logger.info(f'doc == component? {doc == component}') # False