TP6 - Writing Variables in Graphics Mode 
Author Message
 TP6 - Writing Variables in Graphics Mode

Does anyone know how  a method of writing a variable to screen in a
graphics mode?

OUTTEXT( 'DATA : ', IntegerName);

Doesn't work of course, because OUTTEXT only works with text strings.

The only way I can see to do this is to look up a pre-definded table
that caters for all possible values of the variable,  and from it get
a text string that represents the value in the variable.

By doing this tho, I end up with a lot of realy messy code, especially
when I know I am dealing with 3 digit numbers!

Any Ideas?

Thanks.

Ian S.



Wed, 18 Jun 1902 08:00:00 GMT  
 TP6 - Writing Variables in Graphics Mode

Quote:

>Date:       Fri, 29 Mar 1996 11:13:28 GMT

>Newsgroups: comp.lang.Pascal.borland
>Subject:    TP6 - Writing Variables in Graphics Mode

>Does anyone know how  a method of writing a variable to screen in a
>graphics mode?

>OUTTEXT( 'DATA : ', IntegerName);

>Doesn't work of course, because OUTTEXT only works with text strings.

>The only way I can see to do this is to look up a pre-definded table
>that caters for all possible values of the variable,  and from it get
>a text string that represents the value in the variable.

>By doing this tho, I end up with a lot of realy messy code, especially
>when I know I am dealing with 3 digit numbers!

>Any Ideas?

>Thanks.

>Ian S.

You sure don't have your thinking cap on today :)  What you need is a
function.  How about adding the following to your utility unit?

FUNCTION Ascii(Number: LongInt; Width: Integer): String;
{ ================================================================== }
{ Converts a long integer to an ascii decimal string right justified }
{ to width.  (Does NOT truncate!)                                    }
{ ================================================================== }
VAR S: String;
BEGIN
    Str(Number:width,s);
    Ascii := s;
END;

Then you can do something like OUTTEXT( 'DATA : '+Ascii(IntegerName, 1));
or OUTTEXT( 'DATA : '+Ascii(IntegerName, 3));

                      ...red

Knowledge is one of the few things that you
can give away and still keep for yourself.



Wed, 18 Jun 1902 08:00:00 GMT  
 TP6 - Writing Variables in Graphics Mode

Quote:

> Does anyone know how  a method of writing a variable to screen in a
> graphics mode?

> OUTTEXT( 'DATA : ', IntegerName);

> Doesn't work of course, because OUTTEXT only works with text strings.

Use the Str procedure to convert the variable to a string.

Leonard Erickson (aka Shadow)




Wed, 18 Jun 1902 08:00:00 GMT  
 TP6 - Writing Variables in Graphics Mode

Quote:


>Subject: TP6 - Writing Variables in Graphics Mode
>Date: Fri, 29 Mar 1996 11:13:28 GMT
>Does anyone know how  a method of writing a variable to screen in a
>graphics mode?
>OUTTEXT( 'DATA : ', IntegerName);
>Doesn't work of course, because OUTTEXT only works with text strings.
>The only way I can see to do this is to look up a pre-definded table
>that caters for all possible values of the variable,  and from it get
>a text string that represents the value in the variable.
>By doing this tho, I end up with a lot of realy messy code, especially
>when I know I am dealing with 3 digit numbers!
>Any Ideas?
>Thanks.
>Ian S.

Use str( integer_value, screen_string ) and then OutTextXY( x_pos, y_pos,
screen_string ).

bye

JAIME ACEVEDO S.                               Casila 4059 - Valparaiso - Chile
ESCUELA DE INGENIERIA ELECTRICA                Fono (56) 32 257331  Anexo 428
UNIVERSIDAD CATOLICA DE VALPARAISO             Fax  (56) 32 215380



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Blinking text in TP6 graphics modes?

2. writing text to screen while in graphics mode

3. Writing to the screen in graphics mode

4. Writing to screen in graphics mode?

5. Text mode - graphics mode conflict (Help!)

6. Text mode vs graphics mode conflict (Help!)

7. Writing Compiler in TP6.0 - Testing/help wanted.

8. TP6 Graphics

9. Add to protected mode in TP6.0/7.0

10. Writing pointer-variables to file

11. Writing a (new) Enviroment Variable under DOS (w95)

12. Q: How Do I Write Variable for Object?

 

 
Powered by phpBB® Forum Software