adding actionHandler to a listControl

Hi all,

Usually I link a macro to the event "item status changed" of a
listControl via the UI. Now I want to do it at runtime, since the
control itself is created at runtime.

The following code does not result in a noticeable effect when the
selection in the list is changed. What am I missing?

= = = =
Public oLanguageListener

Sub TstLstnr
  CreateLstLanguage_Listener
  oControl = oDlg.getControl("lstTaal")
  oControl.addActionListener(oLanguageListener)
End Sub

Sub CreateLstLanguage_Listener
  sListenerName = "com.sun.star.lang.XActionListener"
  oLanguageListener = CreateUnoListener("LstLanguage_", sListenerName)
End Sub

Sub LstLanguage_disposing (oEvent)
End Sub

Sub LstLanguage_actionPerformed (oEvent As com.sun.star.awt.ActionEvent)
msgbox "actionPerformed"
End Sub

Sub LstLanguage_itemStateChanged (oEvent As com.sun.star.awt.ItemEvent)
msgbox "itemStateChanged "
End Sub

Sub LstLanguage_focusGained (oEvent As com.sun.star.awt.FocusEvent)
'com.sun.star.lang.EventObject
msgbox "focusGained "
End Sub

(same for events focusLost, keyPressed, keyReleased, mouseEntered,
mouseMoved, mouseMovedKeyPressed, mousePressed, mouseReleased, mouseExited)

= = = =

thanks a lot!
Cor

sListenerName = "com.sun.star.awt.XActionListener"

Thanks! Most useful change :wink: