Entering Character from keyboard

Moderator: Rathinagiri

User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Entering Character from keyboard

Post 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
Just Hmg It !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Entering Character from keyboard

Post 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 5834 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 ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Entering Character from keyboard

Post by Pablo César »

Dear Claudio,

Could it be this useful ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Entering Character from keyboard

Post 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
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Entering Character from keyboard

Post 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 !
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Entering Character from keyboard

Post 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
Just Hmg It !
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Entering Character from keyboard

Post 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.
Viva INTERNATIONAL HMG :D
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Entering Character from keyboard

Post by hmgchang »

:lol: Thanks a lot Mr. Esgici...
for your instant response and....
you are very helpful...
you surely read my mind...
:lol:
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Entering Character from keyboard

Post 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
Just Hmg It !
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Entering Character from keyboard

Post 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 ?
Viva INTERNATIONAL HMG :D
Post Reply