Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make text with ASCII Block

Status
Not open for further replies.

VFP2013

Programmer
Oct 19, 2013
20
US
I've seen some programs written in DOS FoxPro and they have text in them made of the ascii block character (█). And I needed to know if there was some function for that, or is it done by hand?
 
What text is in them?

mmerlinn


Poor people do not hire employees. If you soak the rich, who are you going to work for?

"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Raymond
 
It's more like this. As an example:

█ █ █████████
█ █ █
█ █ █
████████ █
█ █ █
█ █ █
█ █ █████████
 
There's no built-in function that does that. There might be one in the code you inherited.

Tamar
 
WAY WAY BACK (before there were rocks) I wrote a FP DOS program that needed to output graphics characters similar to the Block you are looking for.

At that time I had to use a FP-D Add-on library/utility to handle the Graphics.

Unfortunately it was SO LONG AGO that I don't remember what it was, but it was the only way that I could do it. Maybe a Google search will turn up and answer.

Or, maybe (as Tamar suggests above) that library is already contained in the code you inherited.

Good Luck,
JRB-Bldr
 
I've done some of that stuff years ago. And you may already know this but it's a PITA to do it by hand, but it can be done either using @/SAY or ?. Such as:
@ 1, 2 SAY CHR(x) + CHR(x) + CHR(x)
where x is the ASCII character you want to use. The block is CHR(219), but if you're in a FP DOS command window you can pull up the ASCII chart using the 'System->ASCII Chart' menu item to see the others.
You can also from the command window, hold down the 'Alt' key, then type press 0219 on the number pad, and that will put that block in the command window. From there, you can copy/paste and print multiples to make your characters.
For example:
?"██████████"
or
@ 1,1 SAY "██████████"
@ 2,1 SAY "██
@ 3,1 SAY "█████████"
@ 4,1 SAY "██
@ 5,1 SAY "██████████"



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
If you are going to do a lot of these, it would probably be faster (and less error prone) to set up an array for each letter, then the call a function to output each letter.

mmerlinn


Poor people do not hire employees. If you soak the rich, who are you going to work for?

"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Raymond
 
I use this code to display the character set for the DOS apps.
Code:
* CHARS.PRG
SET TALK OFF
CLEAR
?
? "---  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15"
?
I = 0
FOR I = 0 TO 255
    IF MOD(I,16) = 0
       ? RIGHT(STR(I),3)
    ENDIF
    ?? "  " + CHR(I) + " "
NEXT
RETURN
 
If you could not find from the suggestions above, you may want to try to program it yourself. Here are some ideas.

Code:
do display_text with "HELLO WORLD"

return

procedure display_text
    para p_x,p_y, p_text

    if empty(p_text)
       return
    endif

    x_Coordinate = p_x
    y_Coordinate = p_y
    for ii = 1 to len(p_text)
        * Take care of Space and advance x_Coordinate        
         t_call = 'display_'+subs(p_txt,ii,1)
         do &t_call with x_Coordinate, y_Coordinate
    endfor
endproc

procedure dispaly_a
   * Display Letter A 
    para p_x2, p_y2
    t_Graphics = chr(192)
    @ p_x2, p_y2 say t_Graphics
    * and so on
endproc

procedure dispaly_b
endproc

* and so on
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top