3 class AddThread : Thread
12 // MessageBox {}.Modal();
13 form1.AddString(string);
18 void AddItem(const char * string, Seconds delay)
21 strcpy(this.string,string);
26 class AddPacket : Packet
33 class MySocket : Socket
35 void OnReceivePacket(Packet packet)
37 AddPacket addPacket = (AddPacket)packet;
38 AddThread{}.AddItem(addPacket.string, addPacket.delay);
41 void AddItem(const char * string, Seconds delay)
43 int len = strlen(string);
44 uint size = sizeof(class AddPacket) + len;
45 AddPacket packet = (AddPacket)new byte[size];
49 CopyBytes(packet.string, string, len+1);
56 class MyServer : Service
67 background = activeBorder;
68 borderStyle = sizable;
73 size = Size { 640, 480 };
77 this, caption = "Delete", hotKey = del, size = Size { 51, 21 }, position = Point { 424, 152 }, disabled = true;
79 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
81 listBox1.DeleteRow(listBox1.currentRow);
88 parent = this, caption = "Add", isDefault = true, size = Size { 31, 21 }, position = Point { 432, 120 };
90 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
92 socket.AddItem(editBox1.contents, 2);
99 this, caption = "Add2", position = Point { 496, 120 };
101 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
103 socket2.AddItem(editBox1.contents, 0);
110 this, alwaysHighLight = true, caption = "listBox1", hasVertScroll = true, size = Size { 172, 268 }, position = Point { 56, 72 };
112 bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
114 deleteBtn.disabled = row ? false : true;
118 EditBox editBox1 { parent = this, caption = "What to add", contents = "Value", hotKey = w, size = Size { 84, 19 }, position = Point { 304, 120 } };
119 Label label1 { labeledWindow = editBox1, parent = this, size = Size { 68, 13 }, position = Point { 304, 96 } };
123 void AddString(char * string)
127 /*for(row = listBox1.firstRow; row; row = row.next)
128 if(!strcmp(row.string, string))
132 listBox1.AddString(string);
137 sprintf(temp, "Error: The value \"%s\" is already in the list!", string);
138 MessageBox { caption = "Test App", contents = temp }.Create();
144 socket.Connect("localhost", 1234);
145 socket2.Connect("localhost", 1234);
152 MyServer server { port = 1234 };
154 class MyApplication : GuiApplication