On 8/2/05, soonhuat ong <[EMAIL PROTECTED]> wrote:
> For example, each time a purchase is done, i want the system to print a line
> of purchase
> information such as customoer name, price etc ...
You can create a class to handle the printing, initializes an object
of this class in the "initialization section" and releases it in the
"finalization"...
something like:
Print.pas
-----------
type
TPrint = class
procedure PrintLine( const S: string );
:
end;
var
MyPrinter: TPrint;
implementation
:
initialization
MyPrinter := TPrint.Create;
finalization
MyPrinter.Free;
And in your code you just need to call: MyPrinter.PrintLine( 'blablabla' );
Another way is by using class methods, in this way you avoid creating
a global variable...
TPrint = class
class procedure PrintLine( const S: string );
:
end;
implementation
var
PrinterFile: TextFile;
class procedure TPrint.PrintLine( const S: string );
begin
WriteLn( PrinterFile, S );
end;
The initialization of the printer and everything else belongs to you,
now I'll go sleep a little haha :)
--
"ME ALIMENTE [http://br-linux.org/noticias/002750.html] hehe"
"Invente, Tente!!! Faça um código eficiente" (Jonas Raoni haha)
Jonas Raoni Soares Silva
---------------------------
Desenvolvedor de aplicações
jonasraoni at gmail dot com
http://www.joninhas.ath.cx:666
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hmh3vmj/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1122987397/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/