
/**
	@descr	This is a chatwindow with an inputwindow and an output screen and allows the communication between 
		the players while the current game.
	@form	chatGroup(Group)
**/

chatGroup:-
	free(@chatgroup),
	free(@chatwindow),
	free(@chatinput),
	free(@youarelabel),
	free(@chatgroup),
	new(@chatgroup,dialog_group(chat)),
	new(@chatwindow,editor(new(_,text_buffer('')),30,25)),
	new(@youarelabel,label(youarelabel)),
	send(@chatwindow,editable,false),
	send(@youarelabel,value,'You are: yellow'),
	send(@youarelabel,font,new(_,font(helvetica,roman,20))),
	send(@youarelabel,colour,yellow),
	send(@youarelabel,label_format,center),
	send(@youarelabel,background,colour(white)),
	new(@chatinput,text_item('Chat')), new(Button,button(ok,message(@prolog,chat_button_clicked,@chatinput?selection))),
	send(Button,default_button,@on),
	send(Button,displayed,@off),
	send(@chatgroup,append,@youarelabel),
	send(@chatgroup,append,@chatwindow),
	send(@chatgroup,append,@chatinput),
	send(@chatgroup,append,Button),
	send(@chatgroup,area,area(0,0,300,573)).

chat_button_clicked(Message):-
	send(@chatinput,value,''),
	not(Message=''),
	sendmessage(Message).

