#include <stdio.h>
#include <corso.h>

extern XVideoData xvd;

main()
{
	int i,len,width;
	char risposta [80];
	char domanda[80];
	
	// ......................................................... apri la finestra
	StartXWindow(800,600,0,0,"Xleggi",1);
	// ..........................................................................
	risposta[0]=0;
	sprintf(domanda,"Scrivi qualcosa: ");
	len=strlen(domanda);
	width=XTextWidth(xvd.FontInfo[1],domanda,len);
	// ...........................................................................
	for (;;)
	{
		XSetForeground(xvd.display,xvd.gc,xvd.white);
		XFillRectangle(xvd.display,xvd.backpix[0],xvd.gc,0,0,xvd.width[0],
									 xvd.height[0]);
		XSetForeground(xvd.display,xvd.gc,xvd.black);
		if (risposta[0]!=0) XPrintf(0,10,10,1,TRUE,"Hai scritto: %s",risposta);
		risposta[0]=0;
		XPrintf(0,0,80,1,TRUE,"Scrivi qualcosa: ");
		XRedraw();
		XGetAnsw(width,80,1,80,risposta,0);
		if (strstr(risposta,"basta")) break;
	}
	XPrintf(0,100,300,1,TRUE,"Premi un tasto qualunque per uscire");
	XRedraw();
	XWait(0);
}
