Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#1690 closed Bug (No Bug)

GuiTreeView.au3, GuiListView.au3 and possibly others ASCII mode Bug

Reported by: Authenticity Owned by: Jon
Milestone: Component: Standard UDFs
Version: 3.3.6.1 Severity: None
Keywords: Cc:

Description

I didn't have the time to check through all of the functions in these (or other) UDFs, but I'm quite sure there are more:

In _GUICtrlListView_InsertItem function:

If _WinAPI_InProcess($hWnd, $_lv_ghLastWnd) Or ($sText = -1) Then
   $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $pItem, 0, "wparam", "ptr")
Else ; not our control

should be:

If _WinAPI_InProcess($hWnd, $_lv_ghLastWnd) Or ($sText = -1) Then
   If $fUnicode Then
      $iRet = _SendMessage($hWnd, $LVM_INSERTITEMW, 0, $pItem, 0, "wparam", "ptr")
   Else
      $iRet = _SendMessage($hWnd, $LVM_INSERTITEMA, 0, $pItem, 0, "wparam", "ptr")
   EndIf
Else ; not our control

Other text related functions in GuiListView.au3 are probably coded the same.

In _GUICtrlTreeView_GetText function:

If _WinAPI_InProcess($hWnd, $__ghTVLastWnd) Then
   DllStructSetData($tTVITEM, "Text", $pBuffer)
   _SendMessage($hWnd, $TVM_GETITEMW, 0, $pItem, 0, "wparam", "ptr")
Else

should be:

If _WinAPI_InProcess($hWnd, $__ghTVLastWnd) Then
   DllStructSetData($tTVITEM, "Text", $pBuffer)
   If $fUnicode Then
      _SendMessage($hWnd, $TVM_GETITEMW, 0, $pItem, 0, "wparam", "ptr")
   Else
      _SendMessage($hWnd, $TVM_GETITEMA, 0, $pItem, 0, "wparam", "ptr")
   EndIf
Else

Attachments (1)

TestLV.au3 (1.7 KB ) - added by Authenticity 16 years ago.
Example of Unicode and ASCII listviews

Download all attachments as: .zip

Change History (8)

comment:1 by J-Paul Mesnage, 16 years ago

AutoIt is always UNICOdE so the Inprocess is too.
So when this checking is really needed?

in reply to:  1 comment:2 by anonymous, 16 years ago

Replying to Jpm:

AutoIt is always UNICOdE so the Inprocess is too.
So when this checking is really needed?

Whether it's necessary or not, it's up to the service user. If I'm setting the listview Unicode flag to false, inserting and retrieving information should be correct. Right now, if I'm trying to read an item (in ASCII LV format), I get only the first character. Setting the item text results in gibberish.

I think I understand what you mean. GUICtrlCreateListViewItem probably creates only Unicode items. What if I'm not creating the control using GUICtrlCreateListView in first place?

comment:3 by J-Paul Mesnage, 16 years ago

Can you post a non working example?
Thanks

by Authenticity, 16 years ago

Attachment: TestLV.au3 added

Example of Unicode and ASCII listviews

comment:4 by J-Paul Mesnage, 16 years ago

Many thanks.
I am not sure as AutoIt is UNICODE only we still have to support the _GUICtrlListView_SetUnicodeFormat($hLV, false)

But well I understand you can reproduce the behavior you describe.
I will check the AutoIt team decision on the subject.

comment:5 by J-Paul Mesnage, 16 years ago

Owner: changed from Gary to Jon
Status: newassigned

comment:6 by Valik, 16 years ago

Resolution: No Bug
Status: assignedclosed

There is no reason for you to create ANSI controls. AutoIt and Windows are both native UNICODE so using ANSI is just needlessly incurring performance penalties as UNICODE is translated to ANSI. If you insist on using ANSI then you are on your own.

in reply to:  6 comment:7 by Authenticity, 16 years ago

Replying to Valik:

There is no reason for you to create ANSI controls. AutoIt and Windows are both native UNICODE so using ANSI is just needlessly incurring performance penalties as UNICODE is translated to ANSI. If you insist on using ANSI then you are on your own.

No problem. I just saw that the ANSI interface is there and partially implemented by checking whether to allocate "char" or "wchar" buffer. I'm just than fine using UNICODE :)

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.