c++ - Can't get wxTaskBarIcon::CreatePopupMenu() to work -
according this documentation, you're supposed able override wxtaskbaricon::createpopupmenu()
when user right-clicks icon, menu pops up.
however, no matter do, cannot seem force wxwidgets execute damned method! @ point, i'm not sure if because i'm doing c++ inheritance wrong, or whether i'm using wxwidgets wrong. it's driving me crazy!
#include <wx/taskbar.h> #include <wx/menu.h> #include <wx/string.h> class taskbaricon : public wxtaskbaricon { private: wxicon _icon; public: void settooltip(const std::string tooltip); protected: virtual wxmenu * createpopupmenu(); }; void taskbaricon::settooltip(const std::string tooltip) { wxstring wx_tooltip(tooltip.c_str(), wxconvutf8); this->seticon(_icon, wx_tooltip); } wxmenu * taskbaricon::createpopupmenu() { wxmenu * menu = new wxmenu(); menu->append(wxid_close, wxt("exit")); return menu; }
the icon appears fine, tooltip correct, no mount of clicking does anything.
i don't see wrong in code, don't show how create icon -- sorry stupid question, create derived taskbaricon
object?
also, i'd advise check taskbar sample overrides method. if sample doesn't work neither, bug in wxwidgets, if does, can find difference between , code , fix problem in latter.
Comments
Post a Comment