Monday, 26 March 2007
Popup Menu Dialog with GtkMenu Class |
| |
|
| |
Marc Quinton over a post in PHPGTK shows a way to build a popup menu supporting event registration from a GtkWidget. He informs you that menu items are passed to the class constructor as a list of labels. This class emits activate signals with full context.
He gives the details in the following points:
- Create Gtk standard stuff,
- Create a Popup menu in a single a simple line with three items (Edit, Cut, Paste),
- Connect an ‘activate’ callback
- Some items can be insensitive depending on application context,
- Set parent widget; this widget must contain a Window to register some buttons events. No warning about that in this current code, but could be done,
- Look at activate callback; complete event context is available, containing (x,y) coordinates ; may be useful in some usages.
He concludes by giving an example code to carry out the procedure. He also updates that Popup::set_parent() method should be added to avoid simplify event and signal registration.
|
| |
|
Read the Post
|
| |
|
|
| |
|
|
| |
|