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
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 )
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)
I was able to tune this up based on your tip. Quite laborious, but at least you can see the controls in design mode.
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.
@LibreOfficiant and everyone
Here’s one way to give the impression of a MultiPage control:
MultiPageCheat.ods (17.5 KB)
Hi Pertti
Tabbed dialogs will be part of ScriptForge in LO 25.8, in two different flavours:
This is now documented in current help master copy:
Use LO latest build to test this
Hi
Thank you for sharing this information
@LibreOfficiant and everyone
I found another way to get the MultiPage control to use and work (also in older LibreOffice versions). I exported the dialog (.xdl) and manually removed all the controls set on the Pages and then imported the .xdl to a new project. So now I can add controls on the pages on the fly, as well as set event listeners/handlers to them. To make this work don’t set any event’s on any possible controls set onto your Dialog in design mode, otherwise events will confuse the events that are set on the fly and vice versa.
I can take advantage of the location maps I created to the controllers in my previous project (to cheat MultiPage effect), now without need to hide or disable properties of any control.
Instead of function use sub with these:
Sub TopListen_WindowClosing
Continue=false
ThisComponent.setModified(False)
End Sub
Sub TopListen_windowOpened
End Sub
Sub TopListen_windowClosed
End Sub
Sub TopListen_windowMinimized
End Sub
Sub TopListen_windowNormalized
End Sub
Sub TopListen_windowActivated
End Sub
Sub TopListen_windowDeactivated
End Sub
Sub TopListen_disposing
End Sub
Let’s continue on this topic and expand possibilities. In fact, you can even build a Dialog in wich you can read the MultiPage Dialog template to a string and then build a new .xdl file by modifying your string with a string builder e.g to give your MultiPage control a page count you need and some properties (even set controls if you so like) and then save your achievements to a folder you wish. Then you can load it to your project and so on… You can even make a LibreOffice extension of your template builder Dialog or just add it to a tool box, say in Calc…
what is that good for?
btw. meanwhile you should use:
url = uno.fileUrlToSystemPath(
f'{doc.URL}/Scripts/python/{lib_name}' )
# instead of:
url = uno.fileUrlToSystemPath(
'{}/{}'.format(doc.URL,'Scripts/python/'+lib_name))
Pertti initial intent was to re-create VBA original forms using tabs.
The objective is to illustrate that ‘Tabbed Dialogs’ can be designed with ScriptForge in a modular eased way. This may limit dynamic dialogs scripts/macros - such as those using com.sun.star.awt.tab services - requiring numerous and tedious graphical adjustments.
As far as ‘Basic Macro Organizer’ is concerned, this example serve no purpose at all.
… more explanations to come in TDF wiki …
Thx for your Python suggestion. Point taken !
This has expanded to a level I never even imagined. However, this has been an interesting journey, which has also ‘forced’ me to take a deeper look into how the LO Basic environment is implemented. As in return, I have gotten a lot of new ideas.