Get ui element under mouse

Hi, is there a function which returns the ui area/element/property the mouse is currently over?

Properties (ie: BoolProperty, FloatProperty, etc) have no event callbacks such as “onmouseover”, only update or get/set callbacks.

Operators (ie: buttons) can have their properties assigned during invoke op = layout.operator(...) however this means that the values are set during the panel layout.

What are you trying to implement? There might be a workaround.

I think I might be getting somewhere near a resolution:

Here’s what I have so far, but I think I might be barking up the wrong tree.

import bpy
from bl_ui.space_toolsystem_toolbar import  ToolDef
from bl_ui.space_toolsystem_common import description_from_id, ToolSelectPanelHelper




class NOTE_OT_printtooldef(bpy.types.Operator):
    bl_idname = "note.printtooldef"
    bl_label = "print the tool description"
    
   
    
    def execute(self, context):
       
        space_type = context.space_data.type
        
        tool = ToolSelectPanelHelper.tool_active_from_context(context)
       
        
        description = **HOW TO GET DESCRIPTION**
        print(description)
        

        
        return {'FINISHED'}

1 Like

I’m trying to accomplish this as well. @cconst or anyone else: is there a way to get, say, the Location X Float property in the Properties panel if it’s under the mouse on Keypress? I’m aware of context.button_prop from the context Menu, but button_prop isn’t available when hovering over a UI element. This seems possible because the ANIM_OT_keyframe_insert_button operator is able to Insert Keyframes on the active button when hovering over a Float and pressing the I keyboard shortcut.

The PROPERTIES space type is available this way within this context. How about the active UI element (e.g. a Float slider)?