Code: Select all
global rogerActionListener 'global variable where i put XActionListener
sub SetupXActionListener
DialogLibraries.loadLibrary("Standard")
oDialogo = createUnoDialog(DialogLibraries.Standard.Dialog1)
scrlBar = oDialogo.getControl("ListBox1")
' objListBox = oDialogo.getModel().getByName("ListBox1") 'I don't know if this could be the correct place to register that listener
rogerActionListener = CreateUnoListener("XActionListener_","com.sun.star.awt.XActionListener")
oDialogo.getControl("ListBox1").AddActionListener(rogerActionListener) 'it seems which this instruction is correct to register the listener into ListBox1
' objListBox.AddActionListener(rogerActionListener) 'Finally occurs the Listener register
call ListBoxString 'I put this call here because if I don't pull anything in this part, invariably when this sub ends, automatically the macro goes to the method disposing and then I don't know what im doing wrong
end sub
sub removeXActionListener
thisComponent.currentController.removeActionListener(rogerActionListener)
end sub
sub XActionListener_disposing
removeXActionListener
end sub
function XActionListener_actionPerformed(oKeyEvent) 'In this part, the OpenOffice documentation ask the OneWay (void), however i don't understand how that parameter functions
msgBox "Something happened" 'I can not make the macro comes until here
end function