Hey Calvin, Koen,
Indeed, unpredictable result may occurs when you try to remove the
item with index 0, which is currently selected.
The patch to solve this problem is attached.
Regards,
Dmitriy
2010/8/6 Calvin <[email protected]>
> Hi Koen
>
>
> > Certainly that would not be intended. If I understand correclty, you
> > are trying to remove the last item from a WMenu and that fails?
> Yes
>
> >With
> > the latest git that seems to work as expected though (but several
> > changes happened to WMenu since 3.1.3): the currentIndex simply
> > becomes -1.
> >
> > With what version are you seeing the problem ? Dmitriy, do you
> > remember if you have fixed this ?
>
> I am presently working with 3.1.3. Anyway, glad to know that in the latest
> git this is working and looking forward to the next version release. Would
> this be anytime soonish?
>
> Cheers!
>
> Calvin
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
diff --git a/src/Wt/WMenu.C b/src/Wt/WMenu.C
index 5ebd6d2..14527a1 100644
--- a/src/Wt/WMenu.C
+++ b/src/Wt/WMenu.C
@@ -233,7 +233,7 @@ void WMenu::removeItem(WMenuItem *item)
item->setMenu(0);
- if (itemIndex <= current_ && current_ > 0)
+ if (itemIndex <= current_ && current_ >= 0)
--current_;
for (unsigned i = 0; i < items_.size(); ++i)
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest