Page 1 of 2

Entering Character from keyboard

Posted: Fri May 16, 2014 7:27 am
by hmgchang
Dear All,
In some editor if we press Alt+065, it display 'A', cause the ascii for 'A' is 65.
How to get the character of unicode 0x2500 to be displayed ?

TIA

best rgds,
chang

Entering Character from keyboard

Posted: Fri May 16, 2014 11:46 am
by Pablo César
Hi Chang,

You always with new ideas... :)

Try this:

Code: Select all

#include <hmg.ch>

Function Main()
// SET CODEPAGE TO UNICODE
MsgInfo(hb_UChar(0x250C)+Replicate(hb_UChar(0x2500),20)+hb_UChar(0x2510)+CRLF+; // Simple
        hb_UChar(0x2502)+Replicate(hb_UChar(0x2003),20)+hb_UChar(0x2502)+CRLF+;
        hb_UChar(0x2514)+Replicate(hb_UChar(0x2500),20)+hb_UChar(0x2518)+CRLF+;
        hb_UChar(0x250F)+Replicate(hb_UChar(0x2501),20)+hb_UChar(0x2513)+CRLF+; // Heavy
        hb_UChar(0x2503)+Replicate(hb_UChar(0x2003),20)+hb_UChar(0x2503)+CRLF+;
        hb_UChar(0x2517)+Replicate(hb_UChar(0x2501),20)+hb_UChar(0x251B)+CRLF+;
        hb_UChar(0x2554)+Replicate(hb_UChar(0x2550),20)+hb_UChar(0x2557)+CRLF+; // Double
        hb_UChar(0x2551)+Replicate(hb_UChar(0x2007),20)+hb_UChar(0x2551)+CRLF+;
        hb_UChar(0x255A)+Replicate(hb_UChar(0x2550),20)+hb_UChar(0x255D)+CRLF+;
        hb_UChar(0x2504)+Replicate(hb_UChar(0x2504),20)+hb_UChar(0x2504)+CRLF+; // Dash
        hb_UChar(0x250A)+Replicate(hb_UChar(0x2592),20)+hb_UChar(0x250A)+CRLF+;
        hb_UChar(0x2504)+Replicate(hb_UChar(0x2504),20)+hb_UChar(0x2504)+CRLF+;
        hb_UChar(0x2663)+hb_UChar(0x2752)+hb_UChar(0x2713),"Box Drawing")
Return Nil
I found this Box Drawing unicode table, could it be useful: http://www.ssec.wisc.edu/~tomw/java/unicode.html#x2500

And here several unicodes tables:
http://www.ssec.wisc.edu/~tomw/java/unicode.html

UNICODE is wonderful !!!
Screen.PNG
Screen.PNG (10.11 KiB) Viewed 5842 times
P.S.: Dear Chang, IMHO the appropriated title of this topic would it be: "How to display a unicode character". What do you think ?

Entering Character from keyboard

Posted: Fri May 16, 2014 12:53 pm
by Pablo César
Dear Claudio,

Could it be this useful ?

Re: Entering Character from keyboard

Posted: Fri May 16, 2014 5:37 pm
by Javier Tovar
Pablo César wrote:You always with new ideas...
+1

Muy bien Pablo César excelente y gracias hmgchang por aportar nuevas ideas! :D

Saludos

Re: Entering Character from keyboard

Posted: Mon May 19, 2014 3:30 am
by hmgchang
:D Thks for the infos,
Mr. Pablo cesar and Mr. Javier Tovar...

I learnt computer long time ago... with ASCII and have some
text file with box characters that I entered by pressing the Alt+Num keys.
Now i use the Notepad++ to open the prg, and to enhance i choose the
harbour language, but the editor replace all the box character and i dont
get the box chars when i compile the prg.
I really wish to have a simple way or program just to convert the text ASCII/ANSI prg to
the unicode without losing any of the box characters.
It really frustated me to re-enter all the box chars again... :oops:

P.S. : I dont really know how to use SET CODEPAGE, SET LANGUAGE and UNICODE !

Re: Entering Character from keyboard

Posted: Fri May 30, 2014 1:24 am
by hmgchang
Dear Sir,
P.S.: Dear Chang, IMHO the appropriated title of this topic would it be: "How to display a unicode character". What do you think ?
Thats what I need too, but my intention is to be able to enter real unicode box-char by keyboard. The way you show me is the box-char will be displayed when the program is complied and run. I really need the unicode box-char in the editor / source code.

TIA

best rgds,
Chang :D

Re: Entering Character from keyboard

Posted: Fri May 30, 2014 2:51 am
by esgici
hmgchang wrote: Thats what I need too, but my intention is to be able to enter real unicode box-char by keyboard. The way you show me is the box-char will be displayed when the program is complied and run. I really need the unicode box-char in the editor / source code.
Wikipedia wrote:The RichEdit control on Microsoft Windows (as used in for example WordPad) supports the following input method: one first enters the character’s hexadecimal code (between two and six hexadecimal digits), then immediately presses Alt+x. For example, entering f1 and then pressing the combination will produce the character ñ. Unless it is six hexadecimal digits long, the code must not be preceded by any digit or letters a–f as they will be treated as part of the code to be converted. For example, entering af1 followed by Alt+x will produce ૱ (U+0AF1), but entering a0000f1 followed by Alt+x will produce añ. This also works in Microsoft Word 2002/2003 for Windows.
Source is here.

Notes :

1- Save as "Unicode text file" for usability as .prg source file.
2- Our HMG RicheditBox control too supports this Alt+x feature.

Re: Entering Character from keyboard

Posted: Fri May 30, 2014 5:11 am
by hmgchang
:lol: Thanks a lot Mr. Esgici...
for your instant response and....
you are very helpful...
you surely read my mind...
:lol:

Re: Entering Character from keyboard

Posted: Mon Jun 09, 2014 4:53 am
by hmgchang
Dear Sirs,

I cannot use the Alt-X to enter the unicode boxchar... since Alt X is for File-Exit...

Pls advice !


TIA

rgds,
Chang

Re: Entering Character from keyboard

Posted: Mon Jun 09, 2014 2:29 pm
by esgici
hmgchang wrote: I cannot use the Alt-X to enter the unicode boxchar... since Alt X is for File-Exit...
This feature is for only very limited editors; as explained, WordPad, MS Word, HMG Richeditbox control ...

Which editor you are using ?