Modify

#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 on Jun 25, 2010 at 1:35:02 PM.
Example of Unicode and ASCII listviews

Download all attachments as: .zip

Change History (8)

comment:1 by Jpm, on Jun 24, 2010 at 7:05:53 AM

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

in reply to:  1 comment:2 by anonymous, on Jun 24, 2010 at 4:59:52 PM

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 Jpm, on Jun 25, 2010 at 7:23:02 AM

Can you post a non working example?
Thanks

by Authenticity, on Jun 25, 2010 at 1:35:02 PM

Attachment: TestLV.au3 added

Example of Unicode and ASCII listviews

comment:4 by Jpm, on Jun 27, 2010 at 8:15:34 AM

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 Jpm, on Jun 27, 2010 at 8:22:00 AM

Owner: changed from Gary to Jon
Status: newassigned

comment:6 by Valik, on Jun 29, 2010 at 9:42:07 PM

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, on Jun 30, 2010 at 4:36:10 PM

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.