Initgraph and KeyBoard input lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2011-11-21 07:37 Hello guys, who knows me explain why this code does not work?! I would then take an input from the keyboard but does not work! fill would print the message but does not read keyboard input. Why? Code: [Select]Program Prova; Uses Crt,Graph; Var Gd,Gm:integer;     Scelta:char; Begin Gd:=detect; Initgraph(Gd,Gm,'C:\FPC'); Rectangle(0,0,766,1365); SetfillStyle(1,11); Floodfill(1,1,11); Outtextxy(0,40,'Prova!!!'); Outtextxy(0,50,'Questa serve per testare una struttura If...then semplice'); Outtextxy(0,60,'Premi A'); Read(Scelta); If (Scelta='a') then Outtextxy(0,80,'GIUSTO!') else OuttextXy(0,80,'SBAGLIATO!'); Readkey; end. ---------------------------------------------------------------------- xinyiman · 2011-11-21 15:50 No idea?! ---------------------------------------------------------------------- ludob · 2011-11-21 16:41 Are you trying to run this on windows? It'll work but not as you intended  It creates a window to display the graphics and then listen for input on the console. Run it from a console and you see what I mean. To use graph on windows, you need to use winCrt. Here is a modified version that works on windows Code: [Select]Program prova; Uses winCrt,Graph; Var     Gd,Gm:smallint;     Scelta:char; Begin Gd:=detect; Initgraph(Gd,Gm,'C:\FPC'); Rectangle(0,0,100,200); SetfillStyle(1,11); //Floodfill(1,1,11); Outtextxy(0,40,'Prova!!!'); Outtextxy(0,50,'Questa serve per testare una struttura If...then semplice'); Outtextxy(0,60,'Premi A'); Scelta:=readkey; If (Scelta='a') then Outtextxy(0,80,'GIUSTO!') else OuttextXy(0,80,'SBAGLIATO!'); Readkey; end. Don't use read because that is again reading from the console instead of the graphics window.