In a python macro in OO3 i use this snippet of code to run a message box, i've took that from this blog http://universolibre.org/node/27
It simply pop up a message box.
Code: Select all
def MostrarMensaje( Mensaje ):
# El documento desde donde se llama esta macro
oDoc = XSCRIPTCONTEXT.getDocument()
# El manejador de servicios
oSM = uno.getComponentContext().getServiceManager()
# Creamos una instancia del servicio Toolkit
oToolkit = oSM.createInstance( "com.sun.star.awt.Toolkit" )
# Creamos una estructura Rectangulo
rec = uno.createUnoStruct("com.sun.star.awt.Rectangle")
# El tipo de cuadro de mensaje, solo informativo
sTipo = "infobox"
# El Título del cuadro de mensaje
sTitulo = "Mensaje"
# Mostraremos solo el botón Aceptar
botones = 1
# Referencia a la ventana contenedora
oParentWin = oDoc.getCurrentController().getFrame().getContainerWindow()
# Creamos el cuadro de mensaje con los parámetros necesarios
oMsgBox = oToolkit.createMessageBox( oParentWin, rec, sTipo, botones, sTitulo, Mensaje )
# Mostramos el cuadro de mensaje
oMsgBox.execute()
return None If i run that in OO4 with the 2.7 python it pop up an error

It says that the number of the parameter is not correct on the line
oMsgBox = oToolkit.createMessageBox( oParentWin, rec, sTipo, botones, sTitulo, Mensaje )
How can i solve that?
I use OO4 with the bult in OO4 python on win7.
Thanks!