Jump to content



Photo

Compare ListViewItems


  • Please log in to reply
30 replies to this topic

#1 Rahul Rohela

Rahul Rohela

    Adventurer

  • Active Members
  • PipPip
  • 114 posts

Posted 10 June 2006 - 05:16 AM

HI,
Please help me to compare listViewitems item with...
i want to create script that read value form first ListView & compare it with all Items in Second list view.
If match found then... it select next item form first list view and again compare with all items in second list view... if match found.. it follow last procedure & if not found then it will save that item to third list view.


Please hlpe to create compare logic..

Thx
Rahul

Example ListView script attached...
In example i want to Compare Col1 items with Col2 & to add Col1 not matched with Col2 items in Col3

Attached Files









#2 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 10 June 2006 - 06:31 AM

requires beta

AutoIt         
#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("listview items", 460, 350, 100, 200, -1, $WS_EX_ACCEPTFILES) GUISetBkColor(0x00E0FFFF)  ; will change background color $listview = GUICtrlCreateListView("col1  ", 10, 10, 200, 150);,$LVS_SORTDESCENDING) $item1 = GUICtrlCreateListViewItem("item1", $listview) $item2 = GUICtrlCreateListViewItem("item2", $listview) $item3 = GUICtrlCreateListViewItem("item3", $listview) $item4 = GUICtrlCreateListViewItem("item4", $listview) $item5 = GUICtrlCreateListViewItem("item5", $listview) $item6 = GUICtrlCreateListViewItem("item6", $listview) $item7 = GUICtrlCreateListViewItem("item7", $listview) $item8 = GUICtrlCreateListViewItem("item8", $listview) $item9 = GUICtrlCreateListViewItem("item9", $listview) GUICtrlSetState(-1, $GUI_DROPACCEPTED)   ; to allow drag and dropping $listviewB = GUICtrlCreateListView("col2  ", 10, 180, 200, 150);,$LVS_SORTDESCENDING) $itemB1 = GUICtrlCreateListViewItem("item2", $listviewB) $itemB2 = GUICtrlCreateListViewItem("item1", $listviewB) $itemB3 = GUICtrlCreateListViewItem("item3", $listviewB) $listviewC = GUICtrlCreateListView("col3  ", 220, 10, 200, 150);,$LVS_SORTDESCENDING) $btn_compare = GUICtrlCreateButton("Compare", 260, 190, 120, 25) GUISetState() Do     $msg = GUIGetMsg()         Select         Case $msg = $btn_compare             For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1                 $found = False                 $s_item1 = _GUICtrlListViewGetItemText($listview, $x, 0)                 For $y = 0 To _GUICtrlListViewGetItemCount($listviewB) - 1                     $s_item2 = _GUICtrlListViewGetItemText($listviewB, $y, 0)                     If StringUpper($s_item1) = StringUpper($s_item2) Then                         $found = True                         ExitLoop                     EndIf                 Next                 If Not $found Then GUICtrlCreateListViewItem($s_item1, $listviewC)             Next         Case $msg = $listview             MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)     EndSelect Until $msg = $GUI_EVENT_CLOSE

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#3 Rahul Rohela

Rahul Rohela

    Adventurer

  • Active Members
  • PipPip
  • 114 posts

Posted 10 June 2006 - 08:16 AM

gafrost thx for the help..
my problem has solved... but now i am facing very strange problem with
_GUICtrlListViewGetItemText($listview, $x, 0)

function..

I am comparing very large number of values. While running script if i click on some other window or if this script GUI window is not active then its showing ITEM TEXT as -1.
When i am aging select this GUI its start retrieving original text from LISTVIEW.
If i lock the windows screen then its again start retrieving vale as -1. To get it worked properly i am keeping this gui active & PC idle for this work & its very odd situation.
Please help me so that it should work in any case (PC is locked or i am working on other applications)



test script attached... Click on Compare & same time click on some other window... you will find that it will not add value.. if you put msgbox to display listview read value at that time... that will be -1

Attached Files


Edited by Rahul Rohela, 10 June 2006 - 09:24 AM.


#4 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,322 posts

Posted 10 June 2006 - 12:08 PM

gafrost thx for the help..
my problem has solved... but now i am facing very strange problem with
_GUICtrlListViewGetItemText($listview, $x, 0)

function..

I am comparing very large number of values. While running script if i click on some other window or if this script GUI window is not active then its showing ITEM TEXT as -1.
When i am aging select this GUI its start retrieving original text from LISTVIEW.
If i lock the windows screen then its again start retrieving vale as -1. To get it worked properly i am keeping this gui active & PC idle for this work & its very odd situation.
Please help me so that it should work in any case (PC is locked or i am working on other applications)
test script attached... Click on Compare & same time click on some other window... you will find that it will not add value.. if you put msgbox to display listview read value at that time... that will be -1

I have same problem yesterday:
_GUICtrlListViewGetItemText($listview, $x, 0) is working only when my GUI is active.

Look into include\GuiListView.au3 and you will see problem:

Func _GUICtrlListViewGetItemText($h_listview, $i_Item = -1, $i_SubItem = -1, $s_WindowTitle = "", $s_WindowText = "")     Local $X, $count, $str     If (StringLen($s_WindowTitle) == 0) Then         $s_WindowTitle = WinGetTitle("")     EndIf     ...


As you can see he needs also window title for ControlListview and other calls and get it by WinGetTitle("")
which gets title of active window. That's reason of problem.

So solution is to rewrite include\GuiListView.au3\_GUICtrlListViewGetItemText
or you can call directly
ControlListView($s_WindowTitle, $s_WindowText, $h_listview, "GetText", $i_Item, $i_SubItem)
instead of using _GUICtrlListViewGetItemText
and in $s_WindowTitle parameter place handle of your GUI obtained from GUICreate.

#5 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 10 June 2006 - 01:58 PM

I am currently working on a re-write of the GuiListView.au3, working on doing away with the controllistview.

This may take some time.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#6 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,322 posts

Posted 11 June 2006 - 01:24 PM

I am currently working on a re-write of the GuiListView.au3, working on doing away with the controllistview.

This may take some time.

Gary


Hi Gary

If you are working on it, I think it should be done in same way as GUITreeView.au3,
but I expect you know about it :D

As GUIListView.au3 is BIGGEST standard include file, I wish you good luck with rewriting it :D
These standard AutoIt include files are very helpfull inspiration base for me, so I appreciate your work on it.

Zedna

#7 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 11 June 2006 - 06:09 PM

I have the same problem with _GUICtrlListViewGetItemText

Also in my "updater" script it sometimes happens that the .ini file is full of "-1"
Updater

Thanks gafrost for working on it. :D

But is there a temporary workaround ?

Maybe do a "WinActivate" and "WinSetOnTop" just before the "_GUICtrlListViewGetItemText" ?

any ideas ?
D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#8 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 11 June 2006 - 06:57 PM

I have the same problem with _GUICtrlListViewGetItemText

Also in my "updater" script it sometimes happens that the .ini file is full of "-1"
Updater

Thanks gafrost for working on it. :D

But is there a temporary workaround ?

Maybe do a "WinActivate" and "WinSetOnTop" just before the "_GUICtrlListViewGetItemText" ?

any ideas ?


Submitted the new GuiListView.au3 yesterday alnong with some new help file templates and examples.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#9 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 11 June 2006 - 08:12 PM

So I guess it will be in beta release v3.1.1.127 ? :D

That's great !

You are the man ! :D
D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#10 Rahul Rohela

Rahul Rohela

    Adventurer

  • Active Members
  • PipPip
  • 114 posts

Posted 12 June 2006 - 03:22 AM

Problem solved by changing
_GUICtrlListViewGetItemText($listview, $x, 0) to _GUICtrlListViewGetItemText($List_SW,$Count, 0,"GUI Titel")

GUI Title is what i used in
GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )

Thx for help..

Edited by Rahul Rohela, 12 June 2006 - 03:23 AM.


#11 Rahul Rohela

Rahul Rohela

    Adventurer

  • Active Members
  • PipPip
  • 114 posts

Posted 22 June 2006 - 08:08 AM

requires beta

AutoIt         
#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("listview items", 460, 350, 100, 200, -1, $WS_EX_ACCEPTFILES) GUISetBkColor(0x00E0FFFF)  ; will change background color $listview = GUICtrlCreateListView("col1  ", 10, 10, 200, 150);,$LVS_SORTDESCENDING) $item1 = GUICtrlCreateListViewItem("item1", $listview) $item2 = GUICtrlCreateListViewItem("item2", $listview) $item3 = GUICtrlCreateListViewItem("item3", $listview) $item4 = GUICtrlCreateListViewItem("item4", $listview) $item5 = GUICtrlCreateListViewItem("item5", $listview) $item6 = GUICtrlCreateListViewItem("item6", $listview) $item7 = GUICtrlCreateListViewItem("item7", $listview) $item8 = GUICtrlCreateListViewItem("item8", $listview) $item9 = GUICtrlCreateListViewItem("item9", $listview) GUICtrlSetState(-1, $GUI_DROPACCEPTED)   ; to allow drag and dropping $listviewB = GUICtrlCreateListView("col2  ", 10, 180, 200, 150);,$LVS_SORTDESCENDING) $itemB1 = GUICtrlCreateListViewItem("item2", $listviewB) $itemB2 = GUICtrlCreateListViewItem("item1", $listviewB) $itemB3 = GUICtrlCreateListViewItem("item3", $listviewB) $listviewC = GUICtrlCreateListView("col3  ", 220, 10, 200, 150);,$LVS_SORTDESCENDING) $btn_compare = GUICtrlCreateButton("Compare", 260, 190, 120, 25) GUISetState() Do     $msg = GUIGetMsg()         Select         Case $msg = $btn_compare             For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1                 $found = False                 $s_item1 = _GUICtrlListViewGetItemText($listview, $x, 0)                 For $y = 0 To _GUICtrlListViewGetItemCount($listviewB) - 1                     $s_item2 = _GUICtrlListViewGetItemText($listviewB, $y, 0)                     If StringUpper($s_item1) = StringUpper($s_item2) Then                         $found = True                         ExitLoop                     EndIf                 Next                 If Not $found Then GUICtrlCreateListViewItem($s_item1, $listviewC)             Next         Case $msg = $listview             MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)     EndSelect Until $msg = $GUI_EVENT_CLOSE


This is now not working with Beta autoit-v3.1.1.127

Please help

Edited by Rahul Rohela, 22 June 2006 - 08:08 AM.


#12 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 22 June 2006 - 10:25 AM

Works for me...

Might want to check out the following bug fixes, change your Include with these and see if that works.

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

I tested with a large amount of data in the listview(s) with the code below.

Plain Text         
#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("listview items", 460, 350, 100, 200, -1, $WS_EX_ACCEPTFILES) GUISetBkColor(0x00E0FFFF); will change background color $listview = GUICtrlCreateListView("col1 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING) For $x = 1 To 1000     GUICtrlCreateListViewItem("item" & $x, $listview) Next GUICtrlSetState(-1, $GUI_DROPACCEPTED); to allow drag and dropping $listviewB = GUICtrlCreateListView("col2 ", 10, 180, 200, 150);,$LVS_SORTDESCENDING) $itemB1 = GUICtrlCreateListViewItem("item2", $listviewB) $itemB2 = GUICtrlCreateListViewItem("item1", $listviewB) $itemB3 = GUICtrlCreateListViewItem("item3", $listviewB) For $x = 4 To 100     GUICtrlCreateListViewItem("item" & $x, $listviewB) Next     $listviewC = GUICtrlCreateListView("col3 ", 220, 10, 200, 150);,$LVS_SORTDESCENDING) $btn_compare = GUICtrlCreateButton("Compare", 260, 190, 120, 25) GUISetState() Do     $msg = GUIGetMsg()         Select         Case $msg = $btn_compare             For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1                 $found = False                 $s_item1 = _GUICtrlListViewGetItemText($listview, $x, 0)                 For $y = 0 To _GUICtrlListViewGetItemCount($listviewB) - 1                     $s_item2 = _GUICtrlListViewGetItemText($listviewB, $y, 0)                     If StringUpper($s_item1) = StringUpper($s_item2) Then                         $found = True                         ExitLoop                     EndIf                 Next                 If Not $found Then GUICtrlCreateListViewItem($s_item1, $listviewC)             Next         Case $msg = $listview             MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)     EndSelect Until $msg = $GUI_EVENT_CLOSE

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#13 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 22 June 2006 - 02:41 PM

Hi Gafrost
I upgraded to your latest GuiListView.au3 (v1.63)
and applyed the 2 above mentioned bugfixes.


But my "-1" problem in my .ini file seems to have worsened :D

You' ll see what I mean : even moving up or down and then pushing "cancel"
will fill the .ini file with "-1" values now.

Can you please take a look ?

Your changed GuiListView.au3 (that I used for the compile) :


What goes wrong ?

Edited by Gyzmok, 22 June 2006 - 02:44 PM.

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#14 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 22 June 2006 - 02:52 PM

Hi Gafrost
I upgraded to your latest GuiListView.au3 (v1.63)
and applyed the 2 above mentioned bugfixes.
But my "-1" problem in my .ini file seems to have worsened :D

You' ll see what I mean : even moving up or down and then pushing "cancel"
will fill the .ini file with "-1" values now.

Can you please take a look ?

Your changed GuiListView.au3 (that I used for the compile) :


What goes wrong ?

Take the $ off the Front of Total_updates in the ini file

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#15 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 22 June 2006 - 05:23 PM

Ok, Gary the $ should not have been there : nice tnx :D

BUT : The problem did not go away ! :D
It wasn't, untill I went back to your original GuiListView.au3 (v1.63)

The one where I didn't apply the 'bugfixes' :
http://www.autoitscript.com/forum/index.php?showtopic=27914
http://www.autoitscript.com/forum/index.php?showtopic=27921

So : it seems to works fine without the above changes in GuiListView.au3 ?
Guess I stick to this one ?

Edited by Gyzmok, 22 June 2006 - 05:29 PM.

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#16 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 22 June 2006 - 08:05 PM

I looked a bit closer and see where the "-1" came from.

When an error occurs, your UDF returns : $LV_ERR = -1

The line that throws back the error is this line :
If Not GUICtrlSendMsg($h_listview, $LVM_GETITEMTEXTA, $i_Item, DllStructGetPtr($p)) Then Return $LV_ERR

inside the 'bugfixed' code of the UDF : _GUICtrlListViewGetItemText
...     ElseIf ($i_SubItem < $count) Then; return the subitem in the item         DllStructSetData($p, 3, $i_SubItem)         If IsHWnd($h_listview) Then             DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_GETITEMTEXTA, "int", $i_Item, "ptr", DllStructGetPtr($p))             If @error Then Return $LV_ERR         Else             If Not GUICtrlSendMsg($h_listview, $LVM_GETITEMTEXTA, $i_Item, DllStructGetPtr($p)) Then Return $LV_ERR         EndIf         Return DllStructGetData($sp, 1)     Else ... ƒo݊÷ ي.¡»â¢ë%ɽý¶¶©ßÙ¨­ç«®Šìý¸§¶·õ» ~,^w¡×­…©Ûyú+zŠâ‚)ږýzÝ@ÅB¶¹KŠËU‰ìzÒ-zdÞÆÖ®¶ˆ­s`¢ââà ”VÇ6T–b‚b33c¶•õ7V$—FVÒfÇC²b33c¶6÷VçB’F†Vã²&WGW&âF†R7V&—FVÒ–âF†R—FVÐ ”FÆÅ7G'V7E6WDFF‚b33c·Â2Âb33c¶•õ7V$—FVҐ ”–b—4…væB‚b33c¶…öƗ7Gf–Wr’F†Và ’b33c·e÷&WBÒFÆÄ6ÆÂ‚gV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶–çBgV÷C²ÂgV÷Cµ6VæDÖW76vRgV÷C²ÂgV÷C¶‡væBgV÷C²Âb33c¶…öƗ7Gf–WrÂgV÷C¶–çBgV÷C²Âb33c´ÅdÕôtUD•DTÕDU…DÂgV÷C¶–çBgV÷C²Âb33c¶•ô—FVÒÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"‚b33c·’ ”VÇ6P ’b33c·e÷&WBÒuT”7G&Å6VæD×6r‚b33c¶…öƗ7Gf–WrÂb33c´ÅdÕôtUD•DTÕDU…DÂb33c¶•ô—FVÒÂFÆÅ7G'V7DvWEG"‚b33c·’ ”VæD–` •&WGW&âFÆÅ7G'V7DvWDFF‚b33c·7 ”VÇ6P¢ââà


Question : Why does the error occur ?
Is it essential ?
because I have the impression that my script works fine with the code that doesn't report the error. (even when it's there) :D

Edited by Gyzmok, 22 June 2006 - 08:06 PM.

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#17 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 22 June 2006 - 11:05 PM

I looked a bit closer and see where the "-1" came from.

When an error occurs, your UDF returns : $LV_ERR = -1

The line that throws back the error is this line :
If Not GUICtrlSendMsg($h_listview, $LVM_GETITEMTEXTA, $i_Item, DllStructGetPtr($p)) Then Return $LV_ERR

inside the 'bugfixed' code of the UDF : _GUICtrlListViewGetItemText

...     ElseIf ($i_SubItem < $count) Then; return the subitem in the item         DllStructSetData($p, 3, $i_SubItem)         If IsHWnd($h_listview) Then             DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_GETITEMTEXTA, "int", $i_Item, "ptr", DllStructGetPtr($p))             If @error Then Return $LV_ERR         Else             If Not GUICtrlSendMsg($h_listview, $LVM_GETITEMTEXTA, $i_Item, DllStructGetPtr($p)) Then Return $LV_ERR         EndIf         Return DllStructGetData($sp, 1)     Else ... ƒo݊÷ ي.¡»â¢ë%ɽý¶¶©ßÙ¨­ç«®Šìý¸§¶·õ» ~,^w¡×­…©Ûyú+zŠâ‚)ږýzÝ@ÅB¶¹KŠËU‰ìzÒ-zdÞÆÖ®¶ˆ­s`¢ââà ”VÇ6T–b‚b33c¶•õ7V$—FVÒfÇC²b33c¶6÷VçB’F†Vã²&WGW&âF†R7V&—FVÒ–âF†R—FVÐ ”FÆÅ7G'V7E6WDFF‚b33c·Â2Âb33c¶•õ7V$—FVҐ ”–b—4…væB‚b33c¶…öƗ7Gf–Wr’F†Và ’b33c·e÷&WBÒFÆÄ6ÆÂ‚gV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶–çBgV÷C²ÂgV÷Cµ6VæDÖW76vRgV÷C²ÂgV÷C¶‡væBgV÷C²Âb33c¶…öƗ7Gf–WrÂgV÷C¶–çBgV÷C²Âb33c´ÅdÕôtUD•DTÕDU…DÂgV÷C¶–çBgV÷C²Âb33c¶•ô—FVÒÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"‚b33c·’ ”VÇ6P ’b33c·e÷&WBÒuT”7G&Å6VæD×6r‚b33c¶…öƗ7Gf–WrÂb33c´ÅdÕôtUD•DTÕDU…DÂb33c¶•ô—FVÒÂFÆÅ7G'V7DvWEG"‚b33c·’ ”VæD–` •&WGW&âFÆÅ7G'V7DvWDFF‚b33c·7 ”VÇ6P¢ââà


Question : Why does the error occur ?
Is it essential ?
because I have the impression that my script works fine with the code that doesn't report the error. (even when it's there) :D

The error occurs when you try to get text from an item that doesn't exist.
If you noticed in your ini 6 - 99 were -1 because of the default value from the ini read where you were trying to read Total_updates when $Total_updates was in the ini file.

The UDF returns the error, it's up to you to check for an error.

Edited by gafrost, 22 June 2006 - 11:06 PM.

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#18 Rahul Rohela

Rahul Rohela

    Adventurer

  • Active Members
  • PipPip
  • 114 posts

Posted 23 June 2006 - 04:41 AM

Works for me...

Might want to check out the following bug fixes, change your Include with these and see if that works.

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

I tested with a large amount of data in the listview(s) with the code below.

Plain Text         
#include <GUIConstants.au3> #include <GuiListView.au3> GUICreate("listview items", 460, 350, 100, 200, -1, $WS_EX_ACCEPTFILES) GUISetBkColor(0x00E0FFFF); will change background color $listview = GUICtrlCreateListView("col1 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING) For $x = 1 To 1000     GUICtrlCreateListViewItem("item" & $x, $listview) Next GUICtrlSetState(-1, $GUI_DROPACCEPTED); to allow drag and dropping $listviewB = GUICtrlCreateListView("col2 ", 10, 180, 200, 150);,$LVS_SORTDESCENDING) $itemB1 = GUICtrlCreateListViewItem("item2", $listviewB) $itemB2 = GUICtrlCreateListViewItem("item1", $listviewB) $itemB3 = GUICtrlCreateListViewItem("item3", $listviewB) For $x = 4 To 100     GUICtrlCreateListViewItem("item" & $x, $listviewB) Next     $listviewC = GUICtrlCreateListView("col3 ", 220, 10, 200, 150);,$LVS_SORTDESCENDING) $btn_compare = GUICtrlCreateButton("Compare", 260, 190, 120, 25) GUISetState() Do     $msg = GUIGetMsg()         Select         Case $msg = $btn_compare             For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1                 $found = False                 $s_item1 = _GUICtrlListViewGetItemText($listview, $x, 0)                 For $y = 0 To _GUICtrlListViewGetItemCount($listviewB) - 1                     $s_item2 = _GUICtrlListViewGetItemText($listviewB, $y, 0)                     If StringUpper($s_item1) = StringUpper($s_item2) Then                         $found = True                         ExitLoop                     EndIf                 Next                 If Not $found Then GUICtrlCreateListViewItem($s_item1, $listviewC)             Next         Case $msg = $listview             MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)     EndSelect Until $msg = $GUI_EVENT_CLOSE

Not working for me.. I am using windows 2000 prof system..

Its working fine with autoit-v3.1.1.126 not with autoit-v3.1.1.127

Screen shot attched you can see CPU usage to 100% & result is nothing...

#19 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 23 June 2006 - 05:02 AM

Ok Thanks Gary, got it.
(The Total_updates and $Total_updates had nothing to do with it because the default iniread value was 99 and also the value inside the .ini was 99 but tnx for noticing it.)
It was here where the "-1" originated from :
With _iniwrite(), I allways store all colums that are not "empty".
An empty subitem does not simply returns "" from your UDF anymore, but returns "-1" (error) now.
Solution :
I simply changed this :

AutoIt         
func _iniwrite()     for $i = 0 to $Total_updates step 1          if _GUICtrlListViewGetCheckedState($mylist,$i) = 1 then              IniWrite("Updater.ini","TASKS","active"&$i,"1")          Else              IniWrite("Updater.ini","TASKS","active"&$i,"0")          EndIf          if _GUICtrlListViewGetItemText($mylist,$i,1) <> "" then              IniWrite("Updater.ini","TASKS","Task_source"&$i,_GUICtrlListViewGetItemText($mylist,$i,1))          Else              IniWrite("Updater.ini","TASKS","Task_source"&$i,"STOP")          EndIf          if _GUICtrlListViewGetItemText($mylist,$i,2) <> "" then              IniWrite("Updater.ini","TASKS","Task_destination"&$i,_GUICtrlListViewGetItemText($mylist,$i,2))          Else              IniWrite("Updater.ini","TASKS","Task_destination"&$i,"STOP")          EndIf          if _GUICtrlListViewGetItemText($mylist,$i,3) <> "" then              IniWrite("Updater.ini","TASKS","Last_update"&$i,_GUICtrlListViewGetItemText($mylist,$i,3))          Else              IniWrite("Updater.ini","TASKS","Last_update"&$i,"-")          EndIf     Next     sleep(50) EndFunc  ;==>_iniwrite


and it's seems to work fine again. :D

Edited by Gyzmok, 23 June 2006 - 08:57 AM.

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

#20 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 23 June 2006 - 09:05 AM

@ Rahul Rohela : it does work on XP with autoit-v3.1.1.127 and v1.63 GuiListView.au3 + bugfixes on my end.
I cannot test it on Windows 2000 prof here ... :D
Let's see if someone can... ? Gafrost ?
D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users