Jump to content

Attaching a specific button/widget to a listener


Steffen

Recommended Posts

How do i attach a specific button/widget to a listener? Using gwinAttachListener will get me the events from the button but to my understanding also those from all other widgets which is a little impractical when there is a lot of them.

I also found geventAttachSource but could not get this to work as i do not have a GSourceHandle for my button and using the GHandle did nothing. Some of the demo code used gwinGetButtonSource to do that but this function does not seem to exist anymore.

What is the proper way to have only events from specific widgets on a listener?

Link to comment
Share on other sites

Thanks, the tags in combination with the source object is what i ended up using and it worked out rather well thus far.

One thing you could perhaps consider for future versions is to have a option to set user pointers for the tag rather than an u16. This would make it a lot more flexible and in some cases could even remove the need for additional switch cases (i.e directly calling a function pointer from there).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...