Subject Re: ASC code for printable arrow up and arrow down keys
From Mervyn Bick <invalid@invalid.invald>
Date Tue, 9 Jul 2019 14:10:20 +0200
Newsgroups dbase.getting-started
Attachment(s) test_unicode.prg

On 2019-07-08 8:37 PM, Mustansir Ghor wrote:
> Dear All
>
> Can anybody guide me how to print up arrow and down arrow in my text file or in print out.

If your program writes text to a plain text file you're out of luck. If
you are using a report to create the printout then this should be
possible.

Internally dBASE allocates 2 bytes per character in a string.  Both text
and textlabel objects can display 2 byte uni-code characters but when
dBASE for a language which doesn't use 2 byte uni-code writes to a text
file it seems it only writes ? if it encounters a 2 byte character.

To display an up or down arrow in a text object on a form or report you
can change the font setting for an h (up arrow) or an i (down arrow) to
wingdings 3. Unfortunately you can't change just one character in a
string the way you can in, say, Word or a memofield in dBASE.  In a text
object it's all or nothing when you change the object's fontName property.


The alternative is to set the high and low bytes for any character.
That way it doesn't matter what font you are using.

For an up arrow

function TEXTLABEL1_onOpen()
       a = space(1)
       a.setbyte(0,145)
       a.setbyte(1,33)
       this.text = 'Up arrow '+a+' symbol'
       return


For a down arrow

    function TEXTLABEL2_onOpen()
       a = space(1)
       a.setbyte(0,147)
       a.setbyte(1,33)
       this.text = 'Down arrow '+a+' symbol'
       return

The attached example program prints the arrows in the result panel and
then opens the text file in the source code editor so that you can see
what was saved.


Mervyn.



clear
f= new file()
f.create('test_unicode.txt')
a = space(1)
a.setbyte(0,145)
a.setbyte(1,33)
?'Up arrow '+a+' symbol'
f.puts('Up arrow '+a+' symbol')
a.setbyte(0,147)
a.setbyte(1,33)
?'Down arrow '+a+' symbol'
f.puts('Down arrow '+a+' symbol')
f.close()
modi comm test_unicode.txt