Can I switch Tabs using UNO methods?

I’ve created a Tabbed dialog using …awt.tab.UnoControlTabPageContainer service family. Clicks on tabs operate fine. I would like to permute tabs using keyboard event handlers next to mouse clicks.

I cannot identify a method that switches tabs via scripting.

Ctrl+PgUp/Down is the built-in shortcut navigating through tabs.

Thanks for this

What I’m looking for is an UNO method to be scripted in combination with Alt+underlined letter - e.g. ~Tabname - accelerator keys

Based on the sample code by our Finnish friend @Pertsa

Sub Main
REM globalscope.basiclibraries.loadlibrary("XrayTool")
dlg = CreateUnoDialog(DialogLibraries.Standard.UserForm1)
tc = dlg.Controls(22)
tc.activateTab(2)
REM XrayTool._Main.Xray(tc)

dlg.execute()
End Sub

The tab index seems to be 1-based.
The dialog model is useless in this case. The corresponding model property is “MultiPageValue”.
Property ActiveTabID (read-only) gets the active tab ID.

@LibreOfficiant
and everyone…
'Property: MultiPageValue - Value: 4 (I had set it when coding my VBA-tuning)
Dim oControl As Object
oControl = MyForm1.getControl(“MultiPage1”) 'MyForm1 is my Dialog box name
oControl.Model.setPropetyValue(“MultiPageValue”, 1) 'or whatever you want (in limit of the Page count :wink:)

Now it’s just a piece of cake to put a keylistener/event.
Research and more research

Indeed, I missed that property.

@Villeroy @Pertsa
Thanks for your answers. However a multi-page dialog does not convey the UI I’m currently interested in.

You’ll find attached the WiP document containing the Organizer.Controller.KeyListener_keyPressed routine that’s worrying me.
Scripting Tabbed Dialogs.odt (120.6 KB)

@LibreOfficiant

I was able to tune this up based on your tip. Quite laborious, but at least you can see the controls in design mode. :saluting_face:
TabDialogTest.odt (18.6 KB)

To switch between tabs, you need to set a new ActiveTabPageID value.
So in your example:

src.Controls(0).ActiveTabPageID=3

instead of

oTabsListener.ActivateTab(3)

Great !
Thanks

The answer was line# 49 in my Controller module. Stupid me !

You have done a voluminous and interesting job!

I want to avoid the tedious part of setting event handlers dynamically. I’m now evaluating the use of ScriptForge to relink copied controls to pre-defined listeners via SFDialogs.DialogControl read/write event properties.

@LibreOfficiant
It would be really nice if you could let us know when you have progressed to the point where the UI works seamlessly.

As for my own tuning I ran into a practically insurmountable problem trying to port my old VBA tuning to the LibreOffice Basic environment.
I got it to work as it originally did, but the API of the service I used has changed so much that the whole tuning is basically completely useless.
Thanks to your tip, I basically could build a new one by starting from a clean slate.