!7 sclass OSChat extends DynPrintLog { S msg; transient StefansOS_ConnectToServer connector; visualize { ret centerAndSouthWithMargins( super.visualize(), centerAndEastWithMargin(withLabel("Talk to everyone:", jLiveValueTextField_bothWays(dm_fieldLiveValue('msg))), jbutton("Send", rThread sendMsg))); } void sendMsg { S msg = trim(this.msg); if (nempty(msg)) { print("Sending to chat: " + msg); connector.sendLine("chat: " + quote(msg)); } } void cleanMeUp { cleanUp(connector); } start { connector = new StefansOS_ConnectToServer; connector.onLine = voidfunc(S line) { printWithIndent("<< ", line); }; connector.connectWithSubs("chat"); } }