File: Test_MultilistBox.cs

package info (click to toggle)
mygui 3.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,224 kB
  • sloc: cpp: 118,031; ansic: 30,202; xml: 15,544; cs: 12,602; tcl: 776; python: 417; makefile: 34
file content (80 lines) | stat: -rw-r--r-- 2,807 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using MyGUI.Managed;

namespace TestApp.Managed
{
    public class Test_MultiListBox
    {
        public static void Test()
        {
            MultiListBox box = Gui.Instance.CreateWidget<MultiListBox>("MultiListBox", new IntCoord(220, 520, 200, 200), Align.Default, "Main");

            box.EventListChangePosition += new MultiListBox.HandleListChangePosition(box_EventListChangePosition);
            box.EventListSelectAccept += new MultiListBox.HandleListSelectAccept(box_EventListSelectAccept);

            box.AddColumn("column2", 96, "column2");
            box.AddColumn("column3", 96);
            box.InsertColumnAt(0, "column1", 96, "column1");
            box.InsertColumnAt(0, "column4", 96);

            string data = box.GetColumnDataAt(0) as string;
            box.ClearColumnDataAt(0);
            data = box.GetColumnDataAt(0) as string;

            uint count = box.ColumnCount;

            box.SetColumnNameAt(0, "new column");
            string name = box.GetColumnNameAt(0);
            int width = box.GetColumnWidthAt(0);
            box.SetColumnWidthAt(0, width + 1);
            width = box.GetColumnWidthAt(0);

            box.AddItem("item0", "0");
            box.AddItem("item1", "1");
            box.AddItem("item2");
            box.AddItem("item3", "3");
            box.InsertItemAt(0, "insert item4", "4");
            box.InsertItemAt(0, "insert item5");

            count = box.ItemCount;

            name = box.GetItemNameAt(0);
            box.SetItemNameAt(0, "new item 0");
            name = box.GetItemNameAt(0);

            data = box.GetItemDataAt(0) as string;
            box.ClearItemDataAt(0);
            data = box.GetItemDataAt(0) as string;

            box.SetSubItemNameAt(0, 3, "sub item 3");
            name = box.GetSubItemNameAt(0, 0);
            box.SetSubItemNameAt(1, 4, "sub item 4");

            box.SetSubItemDataAt(0, 0, "sub item0");
            data = box.GetSubItemDataAt(0, 0) as string;
            box.ClearSubItemDataAt(0, 0);
            data = box.GetSubItemDataAt(0, 0) as string;

            box.SwapItemsAt(0, 1);

            count = box.ItemCount;
            box.RemoveItemAt(0);
            count = box.ItemCount;

            box.IndexSelected = 0;
            box.IndexSelected = box.IndexSelected + 1;

            box.SortByColumn(0, false);
        }

        static void box_EventListSelectAccept(MultiListBox _sender, uint _index)
        {
            Gui.Instance.Log("TestApp", LogLevel.Info, "EventListSelectAccept  index=" + _index.ToString());
        }

        static void box_EventListChangePosition(MultiListBox _sender, uint _index)
        {
            Gui.Instance.Log("TestApp", LogLevel.Info, "EventListChangePosition  index=" + _index.ToString());
        }
    }
}