Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 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 14 years ago.
Example of Unicode and ASCII listviews

Download all attachments as: .zip

Change History (8)

comment:1 follow-up: Changed 14 years ago by Jpm

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

comment:2 in reply to: ↑ 1 Changed 14 years ago by anonymous

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 Changed 14 years ago by Jpm

Can you post a non working example?
Thanks

Changed 14 years ago by Authenticity

Example of Unicode and ASCII listviews

comment:4 Changed 14 years ago by Jpm

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 Changed 14 years ago by Jpm

  • Owner changed from Gary to Jon
  • Status changed from new to assigned

comment:6 follow-up: Changed 14 years ago by Valik

  • Resolution set to No Bug
  • Status changed from assigned to closed

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.

comment:7 in reply to: ↑ 6 Changed 14 years ago by Authenticity

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 :)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.