Hi Koen,

now clicking on the checkbox works. But clicking on the menu text still does not trigger a change! I've attached a patch which implements a toggling if clicked on the text!

Regards,
Stefan

Am 26.02.2013 22:12, schrieb Koen Deforche:
Hey Stefan,

Indeed, this must be a consequence of merging WPopupMenuItem with
WMenuItem. I've fixed it in my git copy.

Regards,
koen


2013/2/26 Stefan Ruppert <s...@myarm.com <mailto:s...@myarm.com>>

    Hi,

    I have just noticed that a checkable WPopupMenuItem does not trigger the
    action anymore.

    WPopupMenu * popup = new Wt::WPopupMenu()
    WPopupMenuItem* item = popup->addItem(text);
    item->setCheckable(true);
    item->setChecked(true);

    When I hit the text of the popup item nothing happens.
    When I hit the checkbox it is unchecked but the connected slot is not
    called.
    When I hit the text again then the new state of the checkbox is
    propagated to the connected slot!

    Regards,
    Stefan

    
------------------------------------------------------------------------------
    Everyone hates slow websites. So do we.
    Make your web apps faster with AppDynamics
    Download AppDynamics Lite for free today:
    http://p.sf.net/sfu/appdyn_d2d_feb
    _______________________________________________
    witty-interest mailing list
    witty-interest@lists.sourceforge.net
    <mailto:witty-interest@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/witty-interest




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb



_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest


*** kdeforche-wt-8afbefd/src/Wt/WMenuItem	Tue Feb 26 22:23:13 2013
--- kdeforche-wt-8afbefd.new/src/Wt/WMenuItem	Wed Feb 27 10:19:06 2013
***************
*** 367,372 ****
--- 367,373 ----
    void connectClose();
    void connectSignals();
    void setItemPadding(bool padding);
+   void toggle();
  
    friend class WMenu;
    friend class WPopupMenu;
*** kdeforche-wt-8afbefd/src/Wt/WMenuItem.C	Tue Feb 26 22:23:13 2013
--- kdeforche-wt-8afbefd.new/src/Wt/WMenuItem.C	Wed Feb 27 10:39:19 2013
***************
*** 50,55 ****
--- 50,56 ----
  
    if (!text.empty()) {
      text_ = new WText(text, PlainText, this);
+     text_->clicked().connect(this, &WMenuItem::toggle);
    }
  }
  
***************
*** 150,155 ****
--- 151,157 ----
    if (!text_) {
      text_ = new WText(anchor());
      text_->setTextFormat(Wt::PlainText);
+     text_->clicked().connect(this, &WMenuItem::toggle);
    }
  
    text_->setText(text);
***************
*** 501,504 ****
--- 503,513 ----
    }
  }
  
+ void WMenuItem::toggle()
+ {
+   if (checkBox_) {
+     checkBox_->setChecked(!checkBox_->isChecked());
+   }
+ }
+ 
  }
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to