Jump to content
Sign in to follow this  
Armand

Why does 'GUICtrlCreateListViewItem()' looks chumpy ?

Recommended Posts

Armand

any idea on how to fix it ?!

i used to use the UDF, but then i've realized that the UDF doesn't support UNICODE, so i moved to this and not my listview looks very chumpy... maybe i should just convert the UDF functions into UNICODE supporting ones ?!


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
zackrspv

any idea on how to fix it ?!

i used to use the UDF, but then i've realized that the UDF doesn't support UNICODE, so i moved to this and not my listview looks very chumpy... maybe i should just convert the UDF functions into UNICODE supporting ones ?!

chumpy?


-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Share this post


Link to post
Share on other sites
Armand

yeah well... when it loads the items it looks like it refreshes after each item and the entire listview is like FLICKERing ...

it doesn't load up as smooth as the UDF doesn't refresh at all, it just loads up the items....

>> it looks like it's being redrawn many times....

[now u see it, now u have a blank control, now u see it again +1 item... etc]


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
zackrspv

yeah well... when it loads the items it looks like it refreshes after each item and the entire listview is like FLICKERing ...

it doesn't load up as smooth as the UDF doesn't refresh at all, it just loads up the items....

>> it looks like it's being redrawn many times....

[now u see it, now u have a blank control, now u see it again +1 item... etc]

If i remember the help file correctly; to help alleviate the flickering, the extended style: $LVS_EX_DOUBLEBUFFER usually helps with that. but i agree, ive seen that, dunno why tho.

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Share this post


Link to post
Share on other sites
Armand

already used the double buffer... i think that that what's made the UDF work so smooth... [not sure though]... anyways it has no effect on built-in func...


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
Siao

_GUICtrlListView_BeginUpdate()

add items

_GUICtrlListView_EndUpdate()


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
ChrisL

Have you tried this UDF?

; Create and insert items directly into the listview
Func MyGUICtrlCreateListViewItem($sText, $nCtrlID, $nIndex)
    Local $stLvItem = DllStructCreate("uint;int;int;uint;uint;ptr;int;int;int;int;")
    Local $stText   = DllStructCreate("char[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_INSERTITEM, 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_SETITEMTEXT, $nIndex, DllStructGetPtr($stLvItem))
        Next
    EndIf

    $stText     = 0
    $stLvItem   = 0

EndFunc

Share this post


Link to post
Share on other sites
Armand

@Siao

Tried that, not working... still flickering like a disco club!!!

@ChrisL

WHoooHOOO u'r the man !!!

no more flickers !!!!

P.S> i've edited it as follows and now it support UNICODE just like the built-in [the disco built-in function].

Au3. Beta 3.2.11.10.

; #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 @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

Works like a charm for me, thanks for that awesome UDF mate !!!!!!!

@AU3 Developers

-. Please make notice that this function works smoother and better then the built-in.

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
ChrisL

@ChrisL

WHoooHOOO u'r the man !!!

no more flickers !!!!

Works like a charm for me, thanks for that awesome UDF mate !!!!!!!

it's in the help file it's not mine :)

edit: its on the page for GUICtrlRegisterListViewSort

Edited by ChrisL

Share this post


Link to post
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
Sign in to follow this  

×