Problem with treelist on windows o.s.

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
User avatar
marco_84
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jul 08, 2019 7:30 pm

Problem with treelist on windows o.s.

Post by marco_84 » Mon Jul 22, 2019 5:47 pm

Hello at all, in the example posted by doublemax of accessibility, mentioned in the discussion:

accessibility for a blinds users on my project

I have a problem with the treelist on windows o.s., I can't see the treelist on the main window of the program.

I inserted the sizer in this program but I can't see it, I see only the window with the menu bar at the top and I see the status bar at the bottom.

Below the myframe function of the program "minimal.cpp" modified.

Code: Select all

// frame constructor
MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title)
{
    // set the frame icon
    SetIcon(wxICON(sample));

#if wxUSE_MENUS
    // create a menu bar
    wxMenu *fileMenu = new wxMenu;

    // the "About" item should be in the help menu
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");

    fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(fileMenu, "&File");
    menuBar->Append(helpMenu, "&Help");

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);
#endif // wxUSE_MENUS

#if wxUSE_STATUSBAR
    // create a status bar just for fun (by default with 1 pane only)
    CreateStatusBar(2);
    SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR

		wxPanel *panel = new wxPanel(this, wxID_ANY);

    m_treelist = new wxTreeListCtrl( panel, wxID_ANY, wxPoint(10,10), wxSize(300,400), wxTL_SINGLE );

    m_treelist->AppendColumn("First column",
                       wxCOL_WIDTH_AUTOSIZE,
                       wxALIGN_LEFT,
                       wxCOL_RESIZABLE | wxCOL_SORTABLE);

    wxTreeListItem root = m_treelist->GetRootItem();

    wxTreeListItem treelistitem[5];

    treelistitem[0] = m_treelist->AppendItem(root, "item alpha" );
    treelistitem[1] = m_treelist->AppendItem(root, "item bravo" );
    treelistitem[2] = m_treelist->AppendItem( root, "item charlie" );
    treelistitem[3] = m_treelist->AppendItem(root, "item delta" );

#if wxUSE_ACCESSIBILITY
    m_treelist->SetAccessible( new MyListBoxAccessible(m_treelist) );
#endif

    wxSizer* sizertreelist = new wxBoxSizer(wxVERTICAL);
        sizertreelist->Add(m_treelist, wxSizerFlags(0).Expand());
    SetSizer(sizertreelist);
}
thanks for help

marco_84

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2007
Joined: Sun Jan 03, 2010 5:45 pm

Re: Problem with treelist on windows o.s.

Post by PB » Mon Jul 22, 2019 5:49 pm

Just a blind guess (no pun intended). Try changing

Code: Select all

SetSizer(sizertreelist);
to

Code: Select all

panel->SetSizer(sizertreelist);

EDIT
By the way, the Narrator (Windows 10 Pro v1903, English language) narrates the tree in the treectrl sample? And this is kinda expected as wxTreeCtrl on MSW is just a wrapper of the native TREEVIEW there... At least it reads (for a tree item) its label, whether it is expanded, the node number and the number of nodes. But I have no knowledge of how is this supposed to work, so I am probably missing something.

User avatar
marco_84
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jul 08, 2019 7:30 pm

Re: Problem with treelist on windows o.s.

Post by marco_84 » Mon Jul 22, 2019 6:10 pm

OK!!!

solved

thanks PB

Post Reply