File: Test_ComboBox.cs

package info (click to toggle)
mygui 3.4.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 38,800 kB
  • sloc: cpp: 122,825; ansic: 30,231; xml: 15,792; cs: 12,601; tcl: 776; python: 397; makefile: 38
file content (73 lines) | stat: -rw-r--r-- 2,123 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
using MyGUI.Sharp;

namespace TestApp.Sharp
{
	public class Test_ComboBox
	{
		public static void Test()
		{
			ComboBox box = Gui.Instance.CreateWidget<ComboBox>("ComboBox", new IntCoord(120, 320, 200, 26), Align.Default, "Main");
			box.AddItem("line0");//, (int)0);
			box.AddItem("line1");
			box.AddItem("line2");//, (int)2);
			box.AddItem("line3");
			box.AddItem("line4");
			box.AddItem("line5");
			box.AddItem("line6");
			box.AddItem("line7");
			box.AddItem("line8");

			box.InsertItemAt(6, "insert item6");//, "6");
			box.InsertItemAt(7, "insert item7");

			box.MaxListLength = box.MaxListLength + 10;
			box.SmoothShow = !box.SmoothShow;
			box.ComboModeDrop = !box.ComboModeDrop;
			box.ComboModeDrop = !box.ComboModeDrop;

			box.BeginToItemSelected();
			box.BeginToItemLast();
			box.BeginToItemFirst();
			box.BeginToItemAt(2);

			string name = box.GetItemNameAt(2);
			box.SetItemNameAt(2, "new line2");
			name = box.GetItemNameAt(2);

			//box.SetItemDataAt(0, (int)0);
			//object data = box.GetItemDataAt(0);
			//box.SetItemDataAt(3, (int)3);
			//data = box.GetItemDataAt(3);

			//box.ClearItemDataAt(0);
			//data = box.GetItemDataAt(0);
			//data = box.GetItemDataAt(3);

			box.IndexSelected = 1;
			box.IndexSelected = box.IndexSelected + 1;
			box.ClearIndexSelected();

			uint index = box.FindItemIndexWith("line3");
			box.RemoveItemAt(3);
			index = box.FindItemIndexWith("line3");

			box.InsertItemAt(2, "insert line2");//, (int)2);
			name = box.GetItemNameAt(2);
			name = box.GetItemNameAt(3);

			uint count = box.ItemCount;

			box.EventComboAccept += new ComboBox.HandleComboAccept(box_EventComboAccept);
			box.EventComboChangePosition += new ComboBox.HandleComboChangePosition(box_EventComboChangePosition);
		}
		static void box_EventComboChangePosition(ComboBox _sender, uint _index)
		{
			Gui.Instance.Log("TestApp", LogLevel.Info, "EventComboChangePosition  index=" + _index.ToString());
		}

		static void box_EventComboAccept(ComboBox _sender, uint _index)
		{
			Gui.Instance.Log("TestApp", LogLevel.Info, "EventComboAccept  index=" + _index.ToString());
		}
	}
}