Hi,
In lineedit, I like to force it type in Farsi(Persian, which it is activated in windows xp). I can do that in vb by using
GetKeyboardLayout(0) to 67699721
then ActivateKeyboardLayout(0) .How can I do it in Qt, please help.
Thanks
Hi,
In lineedit, I like to force it type in Farsi(Persian, which it is activated in windows xp). I can do that in vb by using
GetKeyboardLayout(0) to 67699721
then ActivateKeyboardLayout(0) .How can I do it in Qt, please help.
Thanks
Qt is C++, you can use any winapi function, just include "windows.h" and use ActivateKeyboardLayout
Thanks a lot; Any examples or link,hint over Internet in this regard?
Thanks again
There is HKL type conversion issue
What should be before t for declaring (int, QString or QVariant are not acceptable), sorry for the .... questionQt Code:
t=GetKeyboardLayout(0) if t=67699721 t=Activat...To copy to clipboard, switch view to plain text mode
please help
thanks
Declare it to be of type HKL, which should be included as a result of including windows.h.
I did but then I cannot write :
the compiler give me error of wrong conversion I tried :
the compiler does not complain but it does not type correct Persian; it types cobination of Persian with someQt Code:
int t= GetKeyboardLayout(0)->i; if (t=67699721) t=ActivateKeyboardLayout(0,0)->i;To copy to clipboard, switch view to plain text mode
other languages; I appriciate your help, a lot
If you are new to C / C++, above line is assignment, not equality test. It sets 't' to have value 67699721, and returns that value. If you want compare values, use 't==other_value'.
According to documentation, there is a method named LoadKeyboardLayout. It expects a "language identifier string", take a look at this list, you can find there id of Persian locale to be 0x0429, so according to this:
you should try somethig like:For example, U.S. English has a language identifier of 0x0409, so the primary U.S. English layout is named "00000409".
Finally, check the output of this method and use GetLastError to know details if something will go wrong.Qt Code:
LoadKeyboardLayout(L"00000429",KLF_ACTIVATE); //!< im not sure about the L ...To copy to clipboard, switch view to plain text mode
Please note that I haven't tried the above code, I'm just guessing how this should look like according to microsoft docs.
-------
edit: I'm not sure about the KLF_ACTIVATE flag either, maybe you'll need to try with other values (described in first link in this post)
Last edited by stampede; 17th February 2011 at 22:42.
Thanks, I will.
Solved, Thanks a lot.
should use == instead of= and the code is 404226304
Bookmarks