Board index » delphi » Assistance with some codes please

Assistance with some codes please

I would appreciate assistance with code for a "Calculator" unit.  I have no
trouble with a simple function (+-/* etc) but I require the usual multiple
calculator functions.  

Also, I have a program which reads an external ASCII txt file, and dependant
on a procedure parameter, each character read is sent either to the screen or
to the printer.  In sending to the screen, I am assigning a text file to CON
as in Write(CON,characters).  This appears to work well, except it uses the
system DOS colors to the screen, in my case white on black.  How can I get my
program to use my choice of screen colors to show these characters, instead
of DOS colors and my fiddling with the ANSI.sys in config.sys?

Next query.... Can someone help with code for a shadow for my box-frames.  I
am currently just drawing a black box offset from the frame to simulate a
shadow, but it would be better to see the background information in the
"shadow".  I am currently saving and etrieving the entire screen in memory to
restore following placing of messages etc, but don't know how to draw just a
small section of the screen.

Thanks in advance.

Peter.

 

Re:Assistance with some codes please


Peter Parkhurst <petep...@powerup.com.au> wrote in article
<5evmto$1d...@grissom.powerup.com.au>...

Quote
> I would appreciate assistance with code for a "Calculator" unit.  I have
no
> trouble with a simple function (+-/* etc) but I require the usual
multiple
> calculator functions.  

> Also, I have a program which reads an external ASCII txt file, and
dependant
> on a procedure parameter, each character read is sent either to the
screen or
> to the printer.  In sending to the screen, I am assigning a text file to
CON
> as in Write(CON,characters).  This appears to work well, except it uses
the
> system DOS colors to the screen, in my case white on black.  How can I
get my
> program to use my choice of screen colors to show these characters,
instead
> of DOS colors and my fiddling with the ANSI.sys in config.sys?

Maybe you didn't realise it. In unit CRT, TextColor and Textbackground is
used to define the colors to written to the screen.

Quote

> Next query.... Can someone help with code for a shadow for my box-frames.
 I
> am currently just drawing a black box offset from the frame to simulate a
> shadow, but it would be better to see the background information in the
> "shadow".

this will involves some assembly language.

Let's talk about shadows part. To see the background text and have a black
shadow, obvious you have to have a black background and visible characters.
In this case, just zero out the background color in the video buffer. To be
more complete, assign the textcolor to something dark like grey(7).

{ Accepts range X = 1..80, Y = 1..25, Length = 1..255, FColor/BColor =
0..15

Procedure TextShadow(X,Y, Length : Byte; FColor, BColor : Byte);
Var VidOfs : Word;
       I : Byte;
Begin
{    dec(Length); }   { prevent off-by-one error }
    dec(X); dec(y);
    VidOfs := (Y * 160) + (X shl 1);   { => (Y * 80 *2) + (X * 2); }   {
calc
    For I := 1 to Length do  { Write video buffer }
          Mem[$B800 : VidOfs +(I * 2)-1] := FColor + (BColor shl 4);
End;

Quote
> I am currently saving and retrieving the entire screen in memory to
> restore following placing of messages etc, but don't know how to draw
just a
> small section of the screen.

there's many reference on how to access the TextScreen. There's also books
on GUI (graphics user interface). I know how to do but dunno how to make
you understand.If you dunno asm, it is useless to carry on. Anyway, since
saving the entire screen works, you can forget about this and do other
things.

I do hope this solve some of your problem.

From Vinson ABS.

Other Threads