Hi All. I have simple login form and macro, which should run on OK btn
But I don’t know how can I get data from my fields withing macro? Think it should be done the same way as another languages via sender object. Please, do you have an example)
Hi All. I have simple login form and macro, which should run on OK btn
Try:
def cmd_ok(event):
button = event.Source
dialog = button.Context
text = dialog.getControl('txt_login')
login = text.Model.Text
return
Oh, thanks, it works with some modification below. But I can’t understand what does “Model”? Just strange result on the console)
# run auth
def run_auth(event):
button = event.Source
dialog = button.Context
text_field = dialog.getControl('tf_login')
login1 = text_field.Model.Text
print(login1)
login2 = text_field.getText()
print(login2)
return
Show me the output of:
print(text_field.ImplementationName)
For my code is:
stardiv.Toolkit.UnoEditControl
Hi, when I do python programming I heavily use xray to examine the variables. Of course you have to install xray before https://web.archive.org/web/20231002132402/https://berma.pagesperso-orange.fr/Files_en/XrayTool60_en.odt
def xray(target):
ctx = XSCRIPTCONTEXT.getComponentContext() # type: ignore
mspf = ctx.ServiceManager.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", ctx)
script_provider = mspf.createScriptProvider("")
script = script_provider.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
script.invoke((target,), (), ())
@ms777 : mri still exists for many years its written in python!
therefore is no need to literally »dig a tunnel to basic-XRay«.
the prototype to introspect any event-triggered:
createUnoService = XSCRIPTCONTEXT.getComponentContext().createInstance
mri = createUnoService("mytools.Mri")
def introspect( event ):
mri.inspect(event)