Ticket #13730: OutlineListView_EachItemUnder.cpp

File OutlineListView_EachItemUnder.cpp, 1.3 KB (added by jalopeura, 2 years ago)

Simple program to reproduce the bug

Line 
1#include <Application.h>
2#include <Window.h>
3#include <OutlineListView.h>
4
5BListItem* eachitemunder(BListItem* item, void* arg) {
6 item->Select();
7 return NULL;
8}
9
10int main() {
11 new BApplication("application/x-vnd.OutlineListView_EachItemUnder.test");
12 BWindow* window = new BWindow(BRect(50,50,550,550), "OutlineListView_EachItemUnder", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE, 0);
13 BOutlineListView* view = new BOutlineListView(BRect(5,5,495,495), "View", B_MULTIPLE_SELECTION_LIST, B_FOLLOW_ALL);
14 window->AddChild(view);
15
16 view->AddItem(new BStringItem("One", 0));
17 view->AddItem(new BStringItem("One-A", 1));
18 view->AddItem(new BStringItem("One-A-1", 2));
19 view->AddItem(new BStringItem("One-B", 1));
20 view->AddItem(new BStringItem("One-C", 1));
21
22 view->AddItem(new BStringItem("Two", 0));
23 view->AddItem(new BStringItem("Two-A", 1));
24 view->AddItem(new BStringItem("Two-A-1", 2));
25 view->AddItem(new BStringItem("Two-B", 1));
26 view->AddItem(new BStringItem("Two-C", 1));
27
28 view->AddItem(new BStringItem("Three", 0));
29 view->AddItem(new BStringItem("Three-A", 1));
30 view->AddItem(new BStringItem("Three-A-1", 2));
31 view->AddItem(new BStringItem("Three-B", 1));
32 view->AddItem(new BStringItem("Three-C", 1));
33
34 view->EachItemUnder(view->ItemAt(5), true, eachitemunder, NULL);
35
36 window->Show();
37 be_app->Run();
38}