Help for GTK API Calling

I want write a program, and need to check is input method is running (Xojo’s KeyDown event always raised, so that I can’t confirm if user press a key is input Chinese Word or want to move position. )


And I am not sure how to call it correctly…

[code]//Soft Declare Function gtk_im_multicontext_new Lib “gtk” () As Ptr
Declare Function gtk_im_multicontext_new lib “” as Ptr
//Declare Function gtk_im_context_filter_keypress lib “” (GtkIMContext as Ptr, GdkEventKey as Ptr) as Boolean
//Declare Function gtk_im_context_filter_keypress lib “” () as Boolean
Soft Declare Function gtk_im_context_filter_keypress Lib “gtk” () as Boolean

'Dim im_context,EventKey As MemoryBlock

If gtk_im_context_filter_keypress()=True Then
End If[/code]

Please help~ Thanks~

I think you need to override the event handler to get EventKey. Not sure how to do that in Linux… or if it’s even possible via declares. Might require a plugin. Maybe MBS can help?

I know there’s GdkEventKey struct, but I’m don’t how do it with xojo… ~"~

And I tried MBS Plugin, same as KeyDown/KeyUp problem, I can’t difference it’s in input method or not…

Are you trying to capture keys in a text field or text area & decide ?

I capture keys in a TextField(1) , and I want to move to next TextField(2) when user press ? .
But when user press down, he may choice a word in input method, also may really want to go next TextFiled…

Well then I’ll ask “does this work correctly in the code editor in the IDE on Linux ?”
If it does then you might want to NOT use a TextArea and consider using the TextInputCanvas.
If it does not then I’d guess we have an issue we need to fix in the text input canvas.

I think there’s no issue with everything, the keyboard is pressed surely, so that KeyDown/KeyUp raised is correct.
So it’s not only happen in Linux, also happen in Mac/Windows.

In my think, I want to use API to check if user in input method, so I found the “gtk-im-context-filter-keypress”.

Now I will try TextInputCanvas, if I make sense how it compiler…

I can say that in OS X the only way to make this work is to use the TextInputCanvas as you cannot handle input methods without it
I’m not certain that is true on Linux & Windows

I still had no idea how TextInputCanvas compiler…

In Xcode, It’s shows 2 warnning, but said success. (and I don’t find where it is.)

In Ubuntu, It’s shows no gtk±2.0 package, I will try build in other version of linux.

TextInputCanvas Compiled Plugin


Thanks a lot. I’ll try it~

Not work in Linux, seems I had to try compiler it under Ubuntu.

Yes sorry It was late and I forgot to add that I compiled it on Mac OS with XCode 5.

You don’t need to say that. Very thanks for your help.

I don’t know even how to compiler in XCode.

Compiled successful.

Enter ‘make’ command at same Folder in Terminal.
If it show’s no gtk2 lib, run ‘sudo apt-get install libgtk2.0-dev’.
Then you will get a .so file as a plug-in.

Great job EShen!

Thanks. :slight_smile:

Now I’m finding documents of this control…

Trying how to input with it… ~"~

This is a good thread from Norman and Joe of Xojo talking about what documentation there is for it.

TextInputCanvas Info Thread


Very useful. I’m reading. Thank you~~

Still had no idea how to use it… <(???)"a

Many Events look like methods and properties.

Are there any examples?