+ if ( prev->IsRadio() )
+ {
+ // This item is in the same group as the preceding one so
+ // we should use the same starting item, but getting it is
+ // a bit difficult as we can't query the start radio group
+ // item for it.
+ const int groupStart = prev->IsRadioGroupStart()
+ ? posItem - 1
+ : prev->GetRadioGroupStart();
+ item->SetRadioGroupStart(groupStart);
+
+ // We must also account for the new item by incrementing
+ // the index of the last item in this group.
+ wxMenuItem* const first = items.Item(groupStart)->GetData();
+ first->SetRadioGroupEnd(first->GetRadioGroupEnd() + 1);
+
+ foundGroup = true;
+ }
+ }