Modify

Opened 16 years ago

Closed 16 years ago

#235 closed Bug (No Bug)

_GUICtrlListView_AddItem() VS GUICtrlCreateListViewItem() + Fix.

Reported by: Shlomikalfa@… Owned by:
Milestone: Component: AutoIt
Version: 3.2.11.10 Severity: None
Keywords: ListView Unicode Cc:

Description

Issues:
-> UDF - doesn't support Unicode. [But works smooth with no flicker.]
-> Built-in - Flickers like a disco light , Re'draws the listview i think. [But support Unicode just fine!]

Please review the following topic as there is a UDF replied by one of the forum members which Combines both the benefits of the above, it doesn't flicker and it does support Unicode.

http://www.autoitscript.com/forum/index.php?showtopic=70227

This is my first bug-report, hope i've done it right.
LOVE YOU ALL !!!!!

Attachments (0)

Change History (6)

comment:1 Changed 16 years ago by TicketCleanup

  • Milestone 3.2.11.11 deleted

Automatic ticket cleanup.

comment:2 Changed 16 years ago by jpm

the difference with the builtin comes from the fact that an autoajustment of the columns size is done. That's producing the flickering try a GUISetState(@SW_LOCK/UNLOCK)
I test a little bit with the GUICtrlCreateListviewItem example without really seing the flickering.
Can you post a repro script? That's the best way to document a bug. I have no cristal ball ...

comment:3 Changed 16 years ago by Gary

If anything this should of been two tickets.

A feature request for the UDFs to be converted to Unicode.
No need for the feature request now. I've converted the GuiListView.au3 to Unicode and will be submitting it.

As to the other I'll leave it up to jpm.

comment:4 Changed 16 years ago by jpm

I am waiting a repro script. Thanks

comment:5 in reply to: ↑ description Changed 16 years ago by Armand

Sorry guys i didn't really thought you'll be responding so fast... god i love you !!!
anyhow, here is a reproduction.

Just start the reproduction using latest beta. [.10.]
click on DanceClub Refresh and start dancing :)
use the other refresh button to see it may also work smooth...
Weird thing is [only on this reproduction it happends] if you click twice on the

normal refreshing button, a TAB-Item disappears... nothing in the function >> called has anything to do with the TAB.

[Reproduction]
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)

;$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $GUI, $hImage

Dim $SearchTableREF[16] = [15, 25, 380, 160, 78, 78, 130, 65, 80, 140, 70, 100, 100, 70, 100, 200]

$GUI = GUICreate("(UDF Created) ListView Create", 500, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitProg")
$TAB = GUICtrlCreateTab(0, 0, 498, 398)
$Tab0 = GUICtrlCreateTabItem("ItemNumber0")
$Tab1 = GUICtrlCreateTabItem("ItemNumber1")

$hListView = GUICtrlCreateListView("#|A|B|C|D|E|F|G|H|I|J|K|L|M", 2, 22, 450, 330, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
;~ >>> You can still dance to the lights of that listview without these !!!
;~ _GUICtrlListView_SetColumnWidth($hListView, 0, Number($SearchTableREF[1]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 1, Number($SearchTableREF[2]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 2, Number($SearchTableREF[3]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 3, Number($SearchTableREF[4]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 4, Number($SearchTableREF[5]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 5, Number($SearchTableREF[7]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 6, Number($SearchTableREF[8]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 7, Number($SearchTableREF[6]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 8, Number($SearchTableREF[9]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 9, Number($SearchTableREF[10]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 10, Number($SearchTableREF[11]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 11, Number($SearchTableREF[12]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 12, Number($SearchTableREF[13]))
;~ _GUICtrlListView_SetColumnWidth($hListView, 13, Number($SearchTableREF[14]))
;~ Dim $B_DESCENDING[_GUICtrlListView_GetColumnCount($hListView)]
;~ _GUICtrlListView_SetUnicodeFormat($hListView, True)

$Button = GUICtrlCreateButton("DanceClub Refresh", 0, 360, 120, 20)
GUICtrlSetOnEvent(-1, "DanceClubPartyLightsTurnOn")
$Button2 = GUICtrlCreateButton("Normal Refresh", 150, 360, 120, 20)
GUICtrlSetOnEvent(-1, "NormalRefresh")

$Tab2 = GUICtrlCreateTabItem("ItemNumber2")
GUICtrlCreateTabItem("")
GUISetState()

; Loop until user exits
While 1
WEnd

Func DanceClubPartyLightsTurnOn()

_GUICtrlListView_DeleteAllItems($hListView)
; Load items
For $i = 0 To 100

GUICtrlCreateListViewItem($i & "|http://www.autoitscript.com/forum/index.php?showtopic=70502|ASDAasdasddddasdasdasdasdasd|ASDASD|ASDAasdasddddasdasdasdasdasd|ASDASD|ASDASD|" _

& "ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd", $hListView)

Next

EndFunc ;==>DanceClubPartyLightsTurnOn

Func NormalRefresh()

_GUICtrlListView_DeleteAllItems($hListView)
; Load items
For $i = 0 To 100

MyGUICtrlCreateListViewItem($i & "|http://www.autoitscript.com/forum/index.php?showtopic=70502|ASDAasdasddddasdasdasdasdasd|ASDASD|ASDAasdasddddasdasdasdasdasd|ASDASD|ASDASD|" _

& "ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd|ASDAasdasddddasdasdasdasdasd", $hListView)

Next
;;; USING THIS FUNCTION >>
;;; because of _UDF lack of ability to support unicode properly.
;;; because of built-in flickering property, [it just flashes like a milion times during the updates].

EndFunc ;==>NormalRefresh

Func ExitProg()

Exit

EndFunc ;==>ExitProg

; #FUNCTION# ====================================================================================================================
; Name...........: MyGUICtrlCreateListViewItem
; Description ...: Create and insert items directly into the listview, Unicode supported!
; Syntax.........: MyGUICtrlCreateListViewItem($sText, $nCtrlID[, $nIndex = -1])
; Parameters ....: $sText - Text of the item and subitems seperated by seperation char. [Default "|"]
; $nCtrlID - Listview control ID.
; $nIndex - Item's index. [Default -1, will add at last location]
; Return values .: Nothing.
; Author ........: Unknown, Supplied by: ChrisL @ http://www.autoitscript.com/forum/index.php?showtopic=70227&view=findpost&p=515453
; Modified.......: Armand.
; ===============================================================================================================================
Func MyGUICtrlCreateListViewItem($sText, $nCtrlID, $nIndex = -1)

Local $stLvItem = DllStructCreate("uint;int;int;uint;uint;ptr;int;int;int;int;")
Local $stText = DllStructCreate("wchar[260]")
Local $arText = StringSplit($sText, "|")

If $nIndex = -1 Then $nIndex = GUICtrlSendMsg($nCtrlID, $LVM_GETITEMCOUNT, 0, 0)

DllStructSetData($stText, 1, $arText[1]); Save the item text in the struct

DllStructSetData($stLvItem, 1, BitOR($LVIF_TEXT, $LVIF_PARAM))
DllStructSetData($stLvItem, 2, $nIndex)
DllStructSetData($stLvItem, 6, DllStructGetPtr($stText))
; Set the lParam of the struct to the line index - unique within the listview
DllStructSetData($stLvItem, 9, $nIndex)

$nIndex = GUICtrlSendMsg($nCtrlID, $LVM_INSERTITEMW, 0, DllStructGetPtr($stLvItem))

If $nIndex > -1 Then

; Insert now the rest of the column text
For $i = 2 To $arText[0]

DllStructSetData($stText, 1, $arText[$i])
DllStructSetData($stLvItem, 3, $i - 1); Store the subitem index

GUICtrlSendMsg($nCtrlID, $LVM_SETITEMTEXTW, $nIndex, DllStructGetPtr($stLvItem))

Next

EndIf

$stText = 0
$stLvItem = 0

EndFunc ;==>MyGUICtrlCreateListViewItem

[PS]
sorry i don't quite know how to put [autoit] brackets in here...

comment:6 Changed 16 years ago by Jpm

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

as I say the builtin is trying to adjust the column size each time you introduce a new item so the flickering occur. just at a GUISetState(@SW_LOCK) before creating the 100 entries and GUISetState(@SW_UNLOCK) afterThat's the difference between the builtin and the UDF

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 ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.