Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Unanswered Edit control: EM_POSFROMCHAR and international support

  • Wednesday, April 11, 2012 1:43 PM
     
     

    Hi,

    a guy in the VB.Net developer forum asked a question that turned out to be a general Windows question. I'm reposting the message here with additional information. I'm using Win7/64.

    Given is the text

    The World دنیا در 23/01/91 زیباترست

    within an edit control (default, not Rich text). Note that the special thing is that, if you move the caret step by step through the text, you will see that the character indexes are not equal to their position. The display is correct. 

    The problem is:  EM_POSFROMCHAR does not return the correct values for all characters. For illustration, have a look at this example: (explanation below).

    The Panel at the bottom shows the characters at their location as it is returned from EM_POSFROMCHAR. I've scaled the X value by 5 because characters overlap each other. Below each character, you see the index within the String. I'm using three lines for the index because some indexes cover each other (like 18 and 26). 

    Compare the output in the painted panel to the Textbox above. You see that some characters are not displayed at the correct location. For example, look at character with index 18 (the digit "2"). It is not displayed in front of the "3". Or character "د" (index 10) which should be shown almost at the right side of the text.

    Is this a known issue?


    Armin

    • Edited by Armin Zingler Wednesday, April 11, 2012 1:49 PM +"in the painted panel"
    •