Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

How to use events #966

Closed
MGlolenstine opened this issue Mar 9, 2020 · 4 comments
Closed

How to use events #966

MGlolenstine opened this issue Mar 9, 2020 · 4 comments

Comments

@MGlolenstine
Copy link

I've noticed, that many Widgets have an events parameter.
I'm assuming that it's a mask, that allows you to filter the events that the view will or will not ignore.
But now I don't know how to implement that.
Does it have something to do with the connect macro?

@sdroege
Copy link
Member

sdroege commented Mar 10, 2020

Yes it's a mask of the values here https://gtk-rs.org/docs/gdk/struct.EventMask.html to enable emission/handling of those windowing system events.

You get notified about those events via the connect_XXX_event() signals.

@GuillaumeGomez
Copy link
Member

Closing then!

@MGlolenstine
Copy link
Author

Ok, but how would I go about adding a BUTTON_RELEASED or even just clicked on a Label?
Is that even possible, or would a workaround have to be used?

@sdroege
Copy link
Member

sdroege commented Mar 11, 2020

You have to create a subclass of gtk::Widget and make use of the button_press_event() virtual method, for example. There are no signals for all events unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants