How to listen to UI element change or selection state?

Hi.

I’ve been googling and trying to do searches in API manual, but I don’t seem to find correct keywords… I simply can’t figure out how to add listeners to buttons or dropdowns in panels.

I created an operator. I added operator to Panel. That was straightforward, as there is no need for listeners… however, I copied some example of dropdown, to select Action:

# picker to pick Action / Pose library
if bpy.context.object.animation_data is not None:
     self.layout.prop(bpy.context.object.animation_data, "action")

I’d like to get some method to listen to selection from this drop down. When user selects pose library A, I’ll show a list containing all the poses from library A. If user selects another pose library, I’ll show its content instead.

Any links, API page locations and other documention links are welcome…

Edit:
I fail to even properly grasp what there self.layout.prop things are - some sort automatic property drawers based on item type? Like operator becomes button.

But what for example is this list of animation data i.e. Actions? Some sort of dropdown. So how to get its type and try to find more info what I can do. I really miss real UI elements, Blenders implementation of UI system feels pretty abstract.

Hi again…

Couldn’t get it to work. So I went for plan b. I just created a button, which I’ll click, after picking Pose/Action:

# button operator stores selected
# action name in custom property
row = layout.row()
row.operator("object.action_select")

# custom property now has selected action name
targetAction = bpy.data.scenes[0].poseLibSel

# do stuff if targetAction is not None

The whole operator for button feels a bit overwhelming, and also can it really be so hard to add some listener to any UI element…? Any ideas.