Sign in to follow this  
Followers 0
florisch

ListView items and subitem insert

4 posts in this topic

Its been long . . .

Problem:

$iIndex = _GUICtrlListViewInsertItem($ListView, $Itemtext)oÝ÷ Ú¬jz-êÛz¯«¶§ØZvV¬·'¬b²z-¦,¹^j|¦¢·­¢)ìz»Zr©ë^®¶Üx^©ÝJæȵé¬Ó~µé­{b±«-®)àÂ+aªê-ªê-±êZ­«h®ÆÞ·Ëצ±+צ±Ú'¢Ø¶Ç­Â+aB¶¹KËUìÇ«´^+ljYbØ^~*ìµÊ%ºiÈ«Þr^­êì"wè®f­ß®¯j¸¨ºÊeiǬjwh¢}©e¶jÖ¢²Ø^­æ§"צël{®×"z+uêí¢W½é¨²Ú¶¡×¥G¢·¬!û¦nWjº.Ö§vfzØb±«­¢+Ù1½°ÀÌØí%ѵQáÐôMÑÉ¥¹MÁ±¥Ð ÀÌØí%ѵÑáаÅÕ½ÐíðÅÕ½Ðì¤)1½°ÀÌØíI½ÝlÅumU  ½Õ¹ ÀÌØí%ѵQáÐ¥t)½ÈÀÌØí¤ôÀѼU    ½Õ¹ ÀÌØí%ѵQáФ´È($ÀÌØíI½ÝlÁulÀÌØí¥tôÀÌØí%ѵQáÑlÀÌØí¤¬Åt)9áÐìÀÌØí¤)}U%
Ñɱ1¥ÍÑY¥Ý}ÉÉä ÀÌØí1¥ÍÑY¥Ü°ÀÌØíI½Ü¤

Does anybody know something more elegant? (Apart from refactoring the complete code.)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Does anybody know something more elegant? (Apart from refactoring the complete code.)

I've had the problem by updating an old Script. I changed it to:

$nItem = $vFilename &"|" &"*" &"|" &$AcPg &"|"&$BM &"|" & $vFileDate &"|" & $aFiles[1]
if _GUICtrlListView_GetSelectedCount($listview) = 0 then 
   GUICtrlCreateListViewItem($nItem, $ListView)
Else
   LVInsertItem($nItem)
endif

...

Func LVInsertItem($nItem)
    $Index = _GUICtrlListView_GetNextItem($Listview)
    _GUICtrlListView_InsertItem($Listview,$nItem, $Index + 1)
    _GUICtrlListView_SetItemText($Listview, $Index + 1,$nItem,-1)
endfunc

HTH, Reinhard

Edited by ReFran

Share this post


Link to post
Share on other sites

Ha! Thats what I was looking for.

_GUICtrlListView_SetItemText($Listview, $Index + 1,$nItem,[b]-1[/b])

With "-1" for Subitem index this sets the complete row. Found it in the Help too, too blind to see it earlier.

Thanks for the help, Reinhard.

The other way round is working fine since I found out that

_GUICtrlListViewGetItemText is better replaced by

_GUICtrlListView_GetItemTextString than

_GUICtrlListView_GetItemText

Share this post


Link to post
Share on other sites

Ha! Thats what I was looking for.

Fine that I could help.

You may have a look at this thread to get some more hints:

http://www.autoitscript.com/forum/index.ph...=70902&st=0

Finally I translated only 2 bigger scripts -

but with intensive using of listviews (old standard UDF) and treeviews (old Au3lib) possibilities (move up/down, insert at, sort, find/replace, edit, .....).

For the listview part I noted:

;; not correct translated

;_GUICtrlListView_InsertItem($listview, $m_ItemNew, $i_to+1)

;_GUICtrlListView_SetItemText($listview, $i_to+1, $m_ItemNew, -1)

;_GUICtrlListView_DeleteItem(GUICtrlGetHandle($listview), $i_to)

I think the sorting routines I also changed manual.

Good luck, Reinhard

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  
Followers 0