Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Is there a way to make Prima widgets accept double byte characters?

by Anonymous Monk
on Jun 06, 2011 at 22:50 UTC ( #908382=note: print w/replies, xml ) Need Help??


in reply to Re: Is there a way to make Prima widgets accept double byte characters?
in thread Is there a way to make Prima widgets accept double byte characters?

I'm not sure, but it seems to me it should be simple to fix :) See http://cpansearch.perl.org/src/KARASIK/Prima-1.30/win32/global.c, it looks like you're not using WM_CHAR/WM_UNICHAR/WM_IME_CHAR -- I don't think IME generating WM_KEYDOWN, WM_KEYUP
  • Comment on Re^2: Is there a way to make Prima widgets accept double byte characters?

Replies are listed 'Best First'.
Re^3: Is there a way to make Prima widgets accept double byte characters?
by dk (Chaplain) on Jun 07, 2011 at 20:40 UTC
    I was reluctant to get inside CIJK because I somehow thought that I have to have a real chinese keyboard, but I gave it a go and installed Chinese layout and lo, I could type unicode! Miracle ))

    Well anyway, yes, WM_CHAR was an easy spot, but strangely enough it only conveyed question mark symbols, never the real chars. Same with WM_IME_CHAR. Finally I found a working method, from GTK - they catch WM_IME_COMPOSITION and explicitly extract the chars by calling ImmGetCompositionStringW.

    I've tried that too, but after typing a test char the Chinese IME died and refused to come up :) Again, thinking that usually IME-aware apps use wide-char win32 API, I've changed calls to RegisterClass and CreateWindow to their wide-char counterparts, and that seemingly helped.

    So I've committed the change, but the problem is, I have no knowledge of Chinese, and my semi-random key strokes that produce a seemingly ok chiniese character doesn't mean that the input is accepted correctly. It seems so, but I'm not 100% sure. So if anyone's willing, you're more than welcome grab the latest Prima from github ( https://github.com/dk/Prima ) and see if that works for your favourite language and IME.

      @dk, thank you for committing the change. I really appreciate it :) But unfortunately the InputLine widget still doesn't work for me :(

      I downloaded the dk-Prima-e3c6fd6.zip file, unzipped it and ran the ms_install.pl file. I got Prima installed successfully

      But when running a Prima app, Perl gives me the following warnings:

      Bareword "km::Unicode" not allowed while "strict subs" in use at C:/Perl/site/li b/Prima/InputLine.pm line 279. Compilation failed in require at C:/Perl/site/lib/Prima/MsgBox.pm line 42. BEGIN failed--compilation aborted at C:/Perl/site/lib/Prima/MsgBox.pm line 42. Compilation failed in require at (eval 72) line 1. BEGIN failed--compilation aborted at (eval 72) line 1. BEGIN failed--compilation aborted at E:\vb.pl line 27.

      Okay, that's not a real problem. I commented out the use strict; line in the InputLine.pm and Edit.pm and running my Prima app again. This time the Prima showed up and then I tried to enter some Chinese characters in the InputLine widget but it didn't work. The widget still refused to accept any IME input. By any I mean I can select English words through the IME but English words from the IME can't be entered in the InputLine widget either. I'm not a GTk user and I don't know if I can enter IME characters with GTk. But both wxPerl and Perl Tk accept IME input from my Chinese system. It's just weird. I'll give it some more tries. Anyway thank you for the effort.
        Hi,

        Can you write me to dmitry@karasik.eu.org? This way we could solve the problem more productively. Also, can you tell which IME did you install? I've installed one called "Chinese Traditional Array 6.0" something, chances are that if you used something else, I should try it too.

        Also, it wouldn't work the way you installed it - you need to run

        perl Makefile.PL dmake dmake install
        (assuming you've running strawberry perl, some other make or nmake otherwise)
Re^3: Is there a way to make Prima widgets accept double byte characters?
by ZJ.Mike.2009 (Scribe) on Jun 07, 2011 at 14:24 UTC
    @Anonymous Monk, thank you for the suggestion. I know nothing about the C language but is it that I only need to add something in the switch block in the global.c source, like:
    case WM_IME_CHAR: ev. key. code = mp1;
    Anyway this is probably the crux of the problem. Thank you :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://908382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-11-29 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?