Re: [help] how to append a picture button to GtkImageMenuItem in gtk+?



Hi,

7.12.2016 17:03 tomsunchen <tomsunchen 126 com> wrote:

 Hi everyone:
    now i want to append button into GtkImageMenuitem, shown as attachment.
  need to add a callback function to delete menu item when user click the
button. can you give me a suggestion or an example? 

Sorry for this late response. What I have here is not a complete
solution but just a tip. GtkMenuItem (also GtkImageMenuItem) derives
from GtkBin. You can put any widget as a child of a bin, the only
limitation is that a bin may have only one child. But nothing stops
you from putting a horizontal GtkBox which will have any number
of children, like images, labels, buttons, etc. You may have
to answer some UX questions like how to provide a flexible keyboard
navigation.

You may need to implement a custom menu item widget.

Adding a callback function to the button seems trivial here.
A tip you may want is that you should attach the menu item
as the user data of the g_signal_connect() call.

Does this answer your question?

Regards,

Rafal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]