Fix behaviour of menu items for wxTR_NO_LINES in the sample

It was getting wrongly updated because the menu item corresponded to the
absence of the style rather than its presence.

Fix this by inverting the menu item meaning, even if it's not very
natural, it should be good enough for the sample and preferable to
complicating its code.
This commit is contained in:
Vadim Zeitlin
2018-08-25 22:28:43 +02:00
parent de5ba70203
commit de33f6715d

View File

@@ -240,7 +240,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons"));
style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons"));
style_menu->AppendSeparator();
style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &connecting lines"));
style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &no lines"));
style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root"));
style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root"));
style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border"));
@@ -387,7 +387,7 @@ void MyFrame::CreateTreeWithDefStyle()
wxMenuBar *mbar = GetMenuBar();
mbar->Check(TreeTest_TogButtons, (style & wxTR_HAS_BUTTONS) != 0);
mbar->Check(TreeTest_TogButtons, (style & wxTR_TWIST_BUTTONS) != 0);
mbar->Check(TreeTest_TogLines, (style & wxTR_NO_LINES) == 0);
mbar->Check(TreeTest_TogLines, (style & wxTR_NO_LINES) != 0);
mbar->Check(TreeTest_TogRootLines, (style & wxTR_LINES_AT_ROOT) != 0);
mbar->Check(TreeTest_TogHideRoot, (style & wxTR_HIDE_ROOT) != 0);
mbar->Check(TreeTest_TogEdit, (style & wxTR_EDIT_LABELS) != 0);