Listening for mouse click events in "Artboard"/"Pasteboard" or outside of plugins menu interface

i want my code to check if a selection has been made or not. not sure 100% how to do this. Idk if theres a way to see if someone clicks outside of the plugin menu interface or if theres a way to listen and check for mouse clicks globally and to see if a selection has been made.

basically what i want to do is disable buttons if nothing is selected and if something is selected then i enable those buttons… in order to do that i need to listen to mouse click or selection globally

any help into the right direction would help. thank you!

The solution is fairly simple using a panel plugin.

Your panel gets a documentChanged callback each time the selection changes and you can inspect the selection (which may be empty) and do whatever you need.

where can i find this event. I have been looking thru the documentation and google and i cant find it.
You said this is a plugin? where can i find this plugin?

https://adobexdplatform.com/plugin-docs/tutorials/quick-start-panel/

I’m talking about the update lifecycle method.

im sorry for being so dumb, im reading the documentation but im still having hard time figuring out how to get that callback. Could you just elaborate a little. Im very grateful for your help. thank you so much

All I can suggest is to look at that tutorial carefully, since it explains it better than I could here, without just re-creating the tutorial.

ok thanks ill just recreate that tutorial then thanks for your feedback!!