Form Caption problem under Windows Xp and unicode

Viewing 20 posts - 1 through 20 (of 22 total)
  • Author
    Posts
  • #33385
    mbagheri
    Participant

    Hi

    I'm using delphi 7 under windows vista, there is no problem there, but when I run my program under windows XP, Titles with Unicode characters are incorrect. I tried to compile the program under windows xp, but the problem exists.
    When I run the program with sSkinManager.Active := false, Titles are correct under both Xp and Vista.
    I tried both 6.44 and 6.47 but the problem still exists.
    I had no such problem with previous versions.

    Thanks

    #40995
    Support
    Keymaster

    Hello
    I'll try to solve this problem in the nearest release. You are using TntControls?
    You can help me if send a small example of the problem.

    #41035
    mbagheri
    Participant

    Hi
    No I'm not using any third party control. Just drop a “SkinManager.Active := true” on a form, and set the form caption to some unicode text. then compile the program. When running under windows Vista, there is no problem, but under previous windows versions the unicode characters are incorrect.

    Thanks for your consideration.

    #41061
    mbagheri
    Participant

    Hi
    I tested v6.48 and v6.50 but the problem still exists!.
    Here is a sample application. (it's compressed with upx)
    you have to set the skin directory. and then you can change the skin from form menu.

    #41072
    Support
    Keymaster

    Hi
    I can explain where is a problem. Delphi 7 haven't a support of unicode, you have correct language in the title because your system have this language by default.
    Look a screenshot, I have this window after running of your example (thanks for Exe). So, your application haven't support of unicode.

    You have good result because your Windows understand a caption and draws it correctly. But Delphi can't do it and all graphical procedures haven't support of unicode.

    Solution : you must use free TntControls for support of unicode in Delphi 7 (sources of AlphaControls are required also) or you can use latest versions of Delphi (you will not have a problems in these cases).

    #41077
    mbagheri
    Participant

    Hi
    Thanks for your reply, but I didn't have this problem with alpha controls v5.xx , It appeared after v6.xx .
    This is right that Delphi 7 doesn't support Unicode, but by setting some options in Windows (Control panel->Regional and Language Options–>in the “Advanced Tab”–>setting “Select a language to match the language version of the non-Unicode programs you want to use” to “Farsi” or “Arabic” – of course you should first install Right-To-Left Languages in the “Languages” tab), non-Unicode programs would also support Unicode characters. and I was using this option. But After upgrading from version 5.xx to 6.xx this problem appeared.

    #41078
    Support
    Keymaster

    Ok, I will research this question with version 5 too. Could you write here something using your language? Thanks.

    #41092
    mbagheri
    Participant

    Hi
    thanks for your reply.
    The attachment is the source of the above test application. you can change the installed version of Alpha Control and rebuild the application and run it under windows XP. (some Persian text is also hard coded in the source).

    #41110
    Support
    Keymaster

    Thank you for demo, but I can't check it still because my system have other language. I have support of all unicode characters in the system, but you saw a screenshot of your application in non-skinned mode… I have '???' always because Form.Caption is not WideString in the Delphi 7.
    I'll try to add some changes in the package code, but I can't check it…

    #41114
    mbagheri
    Participant

    Hi
    You see '?' instead of Unicode characters, because you haven't installed Right-To-Left languages in your windows. You have to Install it form Control Panel –>Regional and Language Options–>Languages –> Check the “install Right-To-Left Languages” check box and press apply. then in the “Advanced Tab”–>set the “Select a language to match the language version of the non-Unicode programs you want to use” combo box to “Farsi”.
    You need the windows XP installation CD for this. and you have to restart your system after making those changes. After that you should have no problem storing Unicode characters in strings.

    Thanks

    #41115
    Support
    Keymaster

    So, main charset must be changed to Farsi on all machines where program must be runned?
    I think it's not good solution… May be used in our situation for testing only.

    #41138
    mbagheri
    Participant

    Hi
    Yes, you have to change the main language to “Farsi”, in order for non Unicode programs to be able to show Farsi texts.

    Thanks

    #41151
    Support
    Keymaster

    QUOTE (mbagheri @ Nov 20 2009, 10:02 AM) <{POST_SNAPBACK}>
    Hi
    Yes, you have to change the main language to “Farsi”, in order for non Unicode programs to be able to show Farsi texts.
    Thanks


    Strange.. no results, after several tries I have '???' still..
    In any case will be released the new version at the nearest days. Please try this version, some changes were added there.

    #41163
    mbagheri
    Participant

    Hi
    I tested the new 6.51 version, the problem still exists.

    QUOTE (Support @ Nov 26 2009, 09:09 AM) <{POST_SNAPBACK}>
    Strange.. no results, after several tries I have '???' still..
    In any case will be released the new version at the nearest days. Please try this version, some changes were added there.

    Maybe it's because you opened and saved the file containing Farsi Characters when the main language was not Farsi, in this case the Unicode characters will be converted and saved to '?'. I think you should download the source code of the test application after you changed your main language to Farsi. and try it again then.

    Maybe this problem occurs because you changed the textout function from a Unicode version to a non-Unicode version or you handle Form.Caption differently. whatever it is, it was OK before and also other components are OK. just Form Caption is invalid.

    Thanks again.

    #41203
    Support
    Keymaster

    Hello

    Could you compile a demo with locale defined manually for program?
    In the Dpr insert “SetThreadLocale($0C01);” after “begin”. Try to compile it and send me this Exe please.

    #41270
    mbagheri
    Participant

    Hi

    I tested the new 6.52 version, but the problem still exists.
    The followings are compiled with SetThreadLocale. (one with 6.51 and another with 6.52)
    Thanks

    #41351
    Support
    Keymaster

    Hi
    It's not easy problem because my system must be reconfigured for the each test. I'll made more test soon on the virtual machine and I hope, that required result will be received.
    Why you not uses the free TntControls package? You will not have a problem with True unicode in this case.

    #41371
    mbagheri
    Participant

    Hi
    Is it possible for you to let me know which file and function is responsible for drawing on form caption area, so I can have a look at it.
    and who knows maybe I could find a solution.

    Thanks

    #41432
    Support
    Keymaster

    You can search this line

    CODE
    FCommonData.FCacheBmp.Canvas.Font.Handle := acGetTitleFont;

    in the sSkinProvider.pas file.
    After the font initialization you can see a part of code with the caption drawing.
    I have tried your program on other machine and have caption drawn correctly, seems (see screenshot).
    It's strange… (why you don't want have a full unicode support?)

    #42405
    mbagheri
    Participant

    Hi
    finally I think I found the problem.
    I think when you initialize the Font (right before drawing form Title), The charset is “WESTERN”, but the component should read this value from the forms' Font property.

    The AddedTitle does not have this problem, because you can set it's Font directly and change the CharSet property. But If you set the charset to “WESTERN” then the AddedTitle would also be messed up like FormCaption.

    In an older version (which didn't have this problem) the Font initialization was like this: “FCommonData.FCacheBmp.Canvas.Font.Assign(Form.Font);”
    but right after changing this line to “FCommonData.FCacheBmp.Canvas.Font.Handle := acGetTitleFont;” this problem appeared.

    so I think this all happens because the charset property of the Title.

    I added this line:
    “FCommonData.FCacheBmp.Canvas.Font.Charset := Form.Font.Charset;”
    after Font initialization in sskinprovider.pas, and it worked ok.

    Thanks

Viewing 20 posts - 1 through 20 (of 22 total)
  • You must be logged in to reply to this topic.