I'm new in the Delphi programming scene and i have trouble calling a procedure in a procedure in my console application.
My simple application is for a item inventory running through a telnet server on windows. I'm using a old thinkpad as my thinclient running linux and a telnet client.
Using Delphi XE I've ran into a chicken or the egg situation.
I get addscreen undeclared indentifier... it is declared but under mainscreen !!! If i put addscreen procedure over the mainscreen one, any call to mainscreen in the addscreen procedure make me an error undeclared indentifier mainscreen!
In simple terms, how to make the procedure to be call everywhere in the program?
I've tried interface and implementation but its not valid in a console application program!
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, windows, messages, Console in 'Console.pas';
procedure mainscreen;
var
choice: string;
begin
clrscr;
writeln(' ------------------------------------------------------------------------------------------------------------------------------');
writeln(' | Inventory Management 0.1 ALPHA |');
writeln(' ------------------------------------------------------------------------------------------------------------------------------');
writeln('');
writeln('');
writeln('');
writeln('');
writeln('');
writeln(' Make a choice: Add(a), Remove(r), Edit(e), Backup Database(bd), Mass Add(ma), Mass Remove(mr)');
writeln('?:');
readln(choice);
if choice = 'a' then
addscreen
else
mainscreen;
end;
procedure addscreen;
var
choice: string;
begin
clrscr;
writeln(' ------------------------------------------------------------------------------------------------------------------------------');
writeln(' | Add an Item |');
writeln(' ------------------------------------------------------------------------------------------------------------------------------');
writeln('');
writeln('');
writeln('');
writeln(' Not yet ready!');
writeln(' Press any key to return to the main menu...');
readln(choice);
mainscreen;
end;
begin
mainscreen;
textbackground(black);
textcolor(lightgray);
ExitProcess(0);
end.
Thank you very much!