At first I thought @sokol92 was just missing that some context switched when a new spreadsheet opened. Not so. There is an unexpected difference given the event order:
Sub Main3
Dim Caller
Dim Spawn
Dim oDialog
Caller = ThisComponent
Caller.DialogLibraries.loadLibrary("Standard")
Spawn = StarDeskTop.loadComponentFromUrl ("private:factory/scalc", "_blank", 0, Array())
oDialog = CreateUnoDialog(Caller.DialogLibraries.Standard.Dialog1)
oDialog.Controls(1).Text = Caller.Title
oDialog.Controls(2).Text = Spawn.Title
oDialog.execute
End Sub
creates a dialog that does not launch the button press event but otherwise seems fine, even though everything is exactly specified.
I have to wonder, in Python it apparently goes like this:
def consoleDlg():
ctx =XSCRIPTCONTEXT.getComponentContext()
smgr = ctx.getServiceManager()
dp = smgr.createInstanceWithContext("com.sun.star.awt.DialogProvider", ctx)
dlg = dp.createDialog( "vnd.sun.star.script:Access2Base.dlgTrace?location=application")
dlg.execute()
dlg.dispose()
Can those same UNO calls be duplicated in BASIC to see if things work? I’m a little out of my depth…frankly, I don’t see where to get XComponentContext from BASIC, or if a person can even “escape out that far” from BASIC.