AutoHotkey Community

It is currently May 26th, 2012, 7:51 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: July 8th, 2005, 9:35 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Hi,

I'm having touble to move backwards through a listview.

I can do it if I move backwards through all of the shown rows.
Code:
  Count := LV_GetCount()
  Loop, %Count%
    {
      Row := Count - A_Index + 1
      MsgBox, %Row%
    }


But I can't if I only want to go to checked rows, the LV_GetNext() prevents it. Or do you know a way?

This is an example of how it could work. Wish for a new command LV_GetPrev
Code:
  Count := LV_GetCount()
  Row := Count + 1
  Loop, %Count%
    {
      Row := LV_GetPrev(Row , "Checked" )
      If not Row
          break
      MsgBox, %Row%
  }


The reason I want to have this: I want to delte checked rows in a listview, but if i move forward through the list I have to remember the rows in reversed order and later delte them, since I can't delte them on the fly because that would screw up the loop. But if I would go backwards, I could delte them as I go through the list (on the fly).

Thanks.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 9:46 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Ok, I found a way,
Code:
  Count := LV_GetCount()
  Loop, %Count%
    {
      Row := Count - A_Index + 1
      RowChecked := LV_GetNext(Row - 1 , "Checked" )
      If not ( Row = RowChecked )
          Continue
      MsgBox, %Row%
    }
Sorry for posting wishes before thinking.
Even though a LV_GetPrev might be faster, since the script doesn't have to go though all rows and check if they are checked.

And if there would be a loop which index counts backwards it would save some of the arkward maths (even though its simple) and two lines of code. I do not know how much extra code this would take in AHK source code, though.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2005, 6:30 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Although there will probably never be an LV_GetPrev() function -- since there is no counterpart in the Windows API on which to base it -- there will probably be a way to get the attributes of a specific row, such as whether it is checked or selected.

Thanks for the example.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group