Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by dk (Chaplain)
on Jun 06, 2011 at 11:59 UTC ( [id://908277]=note: print w/replies, xml ) Need Help??


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

Hi,

As I answered to your bug report https://rt.cpan.org/Public/Bug/Display.html?id=68643 , I have no knowledge on how to emulate Chinise input, so it might be a bug, might be something else , - but anyway I can't possibly fix it because I can't reproduce it. If you feel like debugging Prima and sending a patch, then yes, by all means, please do that.

/dk

Replies are listed 'Best First'.
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
      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.
      @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 :)
Re^2: Is there a way to make Prima widgets accept double byte characters?
by ZJ.Mike.2009 (Scribe) on Jun 07, 2011 at 14:31 UTC
    @dk, thank you for the prompt response. I like Prima anyway. Thank you for sharing with us.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found