Way to see layers attached button and access its userdata?
Posted: Sun Apr 05, 2015 2:17 am
Thought it was handiest using buttons msg.userdata for the task, but now after having implemented that for many many times in my code, i suddenly notice i would need to access that data outside of button being activated, and cant figure out a way to do that.
Thing is, I would need two things:
1. I only have access to the layers name. Is there a way to figure out which button is attached to it? GetAttribue didnt seem to help, as first of all, it doesnt have anything for buttons, and at #LAYERS it doesnt give option to query for the button that is attached to that layer (future feature wish)
2. I could use SetObejctData for that layer to attach that buttons ID for that layer, but is there any way to access buttons "userdata" without actually activating the button?
Only solution that comes to my mind is to do whole load of rewriting and implement setobjectdata/getobjectdata for the layers that represents the button instead of using buttons msg.userdata, but is that really the only solution?
Thing is, I would need two things:
1. I only have access to the layers name. Is there a way to figure out which button is attached to it? GetAttribue didnt seem to help, as first of all, it doesnt have anything for buttons, and at #LAYERS it doesnt give option to query for the button that is attached to that layer (future feature wish)
2. I could use SetObejctData for that layer to attach that buttons ID for that layer, but is there any way to access buttons "userdata" without actually activating the button?
Only solution that comes to my mind is to do whole load of rewriting and implement setobjectdata/getobjectdata for the layers that represents the button instead of using buttons msg.userdata, but is that really the only solution?