Sign in to follow this  
Followers 0
vb6toauto

Edit control not supporting non-english characters ?

6 posts in this topic

Hi all , I'm facing a problem with the edit control it shows the non-english characters as "?" is there a way to fix this in other languages its possible by enabling the left_to_right or disabling it ....

Any ideas would be useful

thanx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Post a specific example. Run this demo and paste "Αυτό είναι μια δοκιμή." into the edit, then hit the TEST button and the text is displayed in the label. Works fine for me.

#include <GuiConstantsEx.au3>

Global $hGUI, $idEdit, $idLabel, $idButton, $sText

$hGUI = GUICreate("Test", 400, 300)
$idEdit = GUICtrlCreateEdit("", 20, 20, 360, 20)
$idLabel = GUICtrlCreateLabel("", 20, 60, 360, 20)
$idButton = GUICtrlCreateButton("TEST", 150, 250, 100, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idButton
            $sText = GUICtrlRead($idEdit)
            GUICtrlSetData($idLabel, "Edit = " & $sText)
    EndSwitch
WEnd

:unsure:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hi PsaltyDS and thanks for reply , I'm already finished my project and its contain alot of the lines similar to what you wrote above, the problem to be more specific is with localization the edit control is not disply the right to left languages like Arabic character encoding the "Αυτό είναι μια δοκιμή." you wrote is also left to right and I'm sure it will disply as you wrote.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Something like this?

#include <GuiConstantsEx.au3>
; http://blogs.msdn.com/b/michkap/archive/2007/03/11/1857043.aspx

Global Const $WS_EX_LAYOUTRTL = 0x400000

$sString = "ويقفز الثعلب البني السريع فوق الكلب الكسول"

$hGUI = GUICreate("Test", 400, 300, Default, Default, Default, $WS_EX_LAYOUTRTL)
$idEdit = GUICtrlCreateEdit($sString, 20, 20, 360, 200)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Edit:

Just applying the style to the control is also enough.

#include <GuiConstantsEx.au3>
; http://blogs.msdn.com/b/michkap/archive/2007/03/11/1857043.aspx

Global Const $WS_EX_LAYOUTRTL = 0x400000

$sString = "ويقفز الثعلب البني السريع فوق الكلب الكسول"

$hGUI = GUICreate("Test", 400, 300)
$idEdit = GUICtrlCreateEdit($sString, 20, 20, 360, 200,Default,$WS_EX_LAYOUTRTL)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by KaFu

Share this post


Link to post
Share on other sites

Thanks Kafu but still not working something wrong cause even the editor showing the text as "?" i even tried the sendmessage which i used before in C# or VB also not working

$Txt = GUICtrlCreateEdit("", 8, 40, 465, 265,Default,0x400000)

also

GUICtrlSendMsg($Txt,0x112,0xF140,0)

Share this post


Link to post
Share on other sites

If you want to use unicode strings within the script, switch the encoding in SciTE "File > Encoding > UTF-8 with BOM". If you're reading the unicode characters from an external source (e.g. text-file), this should still work without switching the script encoding (AutoIt can handle unicode characters internally).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0