Jump to content

GUICtrlCreateListView and Unicode


JoernMaas
 Share

Recommended Posts

Hi,

I ran into some trouble regarding unicode. Which controls can be used for displaying and/or editing unicode? The following example shows, that unicode text entered in the input box as well as in the edit box can display and edit unicode. It seems that the ListView does not support it (yet?). Do I miss something or can somebody confirm this behaviour?

You can easily try it yourself by copying 电话 (Telephone) into the Inputbox and press "Press". It is said in the document for exchanging unicode the clipboard is advisable thats why I did the rather complicated approach of copying. I also tried other things. Not important, just to prove the point.

Can somebody of you give me an answer how to display unicode in a listview?

Oh, just to mention: I am using Beta 3.2.9.11

Regards

#include <GUIConstants.au3>
#include <GuiListView.au3>

Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)

Global $MAIN_GUI, $lv_Basic, $ed_Languages, $txt_Languages, $btn_Press, $lbl_ed

_CreateGUI()

While 1
    Sleep(1000)
WEnd

Func _CreateGUI()
    Local $tempArr, $x, $y, $height
    $tempArr = FileGetTime(@ScriptFullPath)
    $MAIN_GUI = GUICreate("Test [" & $tempArr[2] & $tempArr[1] & $tempArr[0] & "]", 300, 150)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit", $MAIN_GUI)

    $height = 20
    $x = 20
    $y = 5
    $lv_Basic = GUICtrlCreateListView("", $x, $y, 260, $height * 3)
    _GUICtrlListView_InsertColumn($lv_Basic, 0, "Text", 100)
    _GUICtrlListView_InsertColumn($lv_Basic, 1, "Description", 100)

    $y = $y + (3 * $height) + 5
    $ed_Languages = GUICtrlCreateEdit("", $x+60, $y, 90, $height)
  
        $y = $y + $height + 5  
    $lbl_ed = GUICtrlCreateLabel("Enter Text:", $x, $y+4, 90, $height)
    $txt_Languages = GUICtrlCreateInput("", $x+60, $y, 90, $height)
  
    $btn_Press = GUICtrlCreateButton("Press", $x + 160, $y, 100, $height)
    GUICtrlSetOnEvent($btn_Press, "_press")

    GUISetState(@SW_SHOW)
EndFunc ;==>_CreateGUI

Func _press()
    ClipPut(ControlGetText("", "", $txt_Languages))
    _GUICtrlListView_InsertItem($lv_Basic, ClipGet())
    ControlSetText("", "", $ed_Languages, ClipGet())
;_GUICtrlListView_InsertItem($lvTranslations, ControlGetText("", "", $cbLanguages))
EndFunc ;==>_press

Func _exit()
    Exit
EndFunc ;==>_exit
Edited by JoernMaas
Link to comment
Share on other sites

It seems that the ListView does not support it (yet?).

Correction - ListView UDF does not support unicode yet.

You can add it on your own for now...

In Include\GuiListView.au3,

copy _GUICtrlListView_InsertItem function to _GUICtrlListView_InsertItemW, then change text buffer structure ($tBuffer) type from char to wchar, and all messages $LVM_INSERTITEMA to $LVM_INSERTITEMW

Or simply use GUICtrlCreateListViewItem to add items.

Edited by Siao

"be smart, drink your wine"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...