Hello,
I need help for a very old code (TP3 and DOS, maybe recompiled in TP6, I don%u2019t remember)
I was able to porting it in Lazarus (Laz.2.0.10, FPC 3.2.0) on Win 10 por -64 bit, and it basically works.
Two things I wasn%u2019t able to solve:
1) The program uses %u201Cgraphical output%u201D and at the start the program opens 2 windows (in DOS mode), the first one can accept keyboard input and the second one is for the graphical program (the only one I expect to have !). This seems that implies keyboard input cannot received by the %u201Cgraphic windows%u201D, but it works fine if I insert input on the on the first windows. I need to input directly on the graphic window%u201D!
2) I have in my old code the %u201Cinterrupt%u201D approach to handle of mouse input. I removed such routines, but how to manage mouse inputs in the %u201Cgraphical windows%u201D ?
In the figure (fig.1 and fig.2) the two input windows side by side (I need only the graphical one), I was able, in the old version, to use different cursor and selecting and moving elements of graphical window.
The program should work reading just one char (the capital one in the command menu)
attached the most relevant code (if needed I can post more) for comment (but complete alternative to do the job are welcome)
USES Dos,Crt,Graph,GraphPV,UO;
CONST ESC = #27;
ENDWORK = 10;
(****************************** MAIN ***************************************)
Begin
InizializzaGrafica(1);
IF (GraphResult <> GrOK) Then Begin
Write('Sorry, no VGA, Bye-Bye ! ');
Readln;
Halt;
End;
Presentation; //just show the "LOGO" an wait for "ReaLn;" to go on
SetScreen; //here start the Graph code
Repeat
ProcessInput; //wait for input/action user -> here I need:
// 1) to work on the graphical windows
// 2) mouse usage on the graphical windows
Until (Stop = ENDWORK);
CloseGraph;
End.
where
Procedure InizializzaGrafica(a:Word);
var g1,g2:smallInt;
Begin
Case a OF
0:Begin g1:=Detect; End;
1:Begin g1:=Vga; g2:=VgaHi; End;
2:Begin g1:=Vga; g2:=VgaMed; End;
End;
initgraph(g1,g2,'');
End;
PROCEDURE ProcessInput; (* *)
Begin
InputMouseKeyb;
Case Stop OF
0:
Begin
End;
1:
Begin
Case InpKey OF
ESC:
Begin
Stop:=ENDWORK;
End;
'N','n':
Begin
IF (LastZero <= MaxRadici) Then
Begin
Inc(LastZero);
NewZero;
End
Else
(* ? *) MessagWin(' Raggiunto il max Numero di Zeri ');
End;
'O','o':
Begin
LastZero:=NumeroElementi;
OrchPencil;
End;
'M','m':
Begin
Select;
End;
'D','d':
Begin
RemoveZero;
End;
'C','c':
Begin
ComputingFunction;
End;
'R','r':
Begin
SetFillStyle(SolidFill,Black);
Bar(Bordo1,Bordo1,MaxXScreen-Bordo1,MaxYScreen-Bordo2);
SetScreen;
SetFillStyle(SolidFill,Blue);
End;
'E','e':
Begin
NewCommand;
ManipulateZero;
MainCommand;
End;
'p','P':
Begin
SetFillStyle(SolidFill,Black);
Bar(20,20,200,200);
End;
End;
End;
2:
Begin
End;
3:
Begin
Stop:=ENDWORK;
End;
End;
End;
PROCEDURE InputMouseKeyb; (* lettura dell'input *)
Begin
Stop:=-1;
Repeat
IF KeyPressed Then
Begin
InpKey:=ReadKey;
IF InpKey = #0 Then
Begin
InpKey:=ReadKey;
Stop:=0;
End
Else
Stop:=1;
End
Else
Begin
End;
Until (Stop >= 0) AND (Stop <= 3);
End;