trids Posted August 26, 2004 Author Share Posted August 26, 2004 I was also thinking that the ability to state only the items you don't want to select could be useful. Control...... "selectclear" Control...... "unselect", "3,12" <{POST_SNAPBACK}>... Hmmm, good point about unselecting: maybe we need a "selectall" command as well: Control...... "selectall" Control...... "unselect", "3,12" Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 26, 2004 Administrators Share Posted August 26, 2004 (edited) Way ahead of ya: - LV_ItemText, index, subindex - LV_SelectAll - LV_SelectClear - LV_Select, from index, [to index] - LV_Deselect, from index, [to index] - LV_GetItemCount - LV_GetSubItemCount - LV_IsSelected, index - LV_GetSelected, [0 = single/first, 1 = multiple delimited by |) Edited August 26, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
bigred Posted August 26, 2004 Share Posted August 26, 2004 Ohh very nice. Also will there be a way to have the command only return list entries that have text in them? One of the list's I am working with has 30 list item spaces in it. Usually only 7-10 are used, so I could see that if I didn't know the number of entries and just used "selectall", I would get the first 10 entries with text, but also the next 20 that are empty would be shown as line returns. Link to comment Share on other sites More sharing options...
trids Posted September 6, 2004 Author Share Posted September 6, 2004 This is me playing around with the new listview magic :;Wait for the folder to be activated, which is named "WWW" ;..and which has 9 shortcuts in it = listitems WinWaitActive("WWW") $hWnd = ControlGetHandle("", "", "SysListView321") msgbox (0,"$hWnd",$hWnd) $vRet = ControlCommand("","",$hWnd, "LV_GetItemCount") $sRet = "" & $vRet & "::" $vRet = ControlCommand("","",$hWnd, "LV_GetSubItemCount") $sRet = $sRet & $vRet msgbox (0,"LV_GetItemCount::LV_GetSubItemCount",$sRet) WinActivate("WWW") $vRet = ControlCommand("","",$hWnd, "LV_SelectAll") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_SelectClear") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_Select", "5", "9") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_Deselect", "2", "7") Sleep(2000) msgbox (0,"","Select some items and i'll tell you which they are") $vRet = ControlCommand("","",$hWnd, "LV_GetSelected", "1") msgbox (0,"LV_GetSelected",$vRet) $vRet = ControlCommand("","",$hWnd, "LV_GetItem", "1", "1") msgbox (0,"LV_GetItem",$vRet)Questions for Jon or anyone else who knows ..1. I can't seem to get the LV_GetItem command to work. Any ideas?2. How do I select items: 2,4,6 and 8 .. in one statement?3. It would be more consistent if the LV_GetSelected referred to items in the same terms as LV_Select: At the moment, LV_GetSelected is zero-based.4. How do I select an item by name?5. What other listview commands can I test? And sample syntax please, in the absence of documentation?Thanks for all the hard work in getting us this far .. Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 6, 2004 Administrators Share Posted September 6, 2004 (edited) This is me playing around with the new listview magic :;Wait for the folder to be activated, which is named "WWW" ;..and which has 9 shortcuts in it = listitems WinWaitActive("WWW") $hWnd = ControlGetHandle("", "", "SysListView321") msgbox (0,"$hWnd",$hWnd) $vRet = ControlCommand("","",$hWnd, "LV_GetItemCount") $sRet = "" & $vRet & "::" $vRet = ControlCommand("","",$hWnd, "LV_GetSubItemCount") $sRet = $sRet & $vRet msgbox (0,"LV_GetItemCount::LV_GetSubItemCount",$sRet) WinActivate("WWW") $vRet = ControlCommand("","",$hWnd, "LV_SelectAll") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_SelectClear") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_Select", "5", "9") Sleep(2000) $vRet = ControlCommand("","",$hWnd, "LV_Deselect", "2", "7") Sleep(2000) msgbox (0,"","Select some items and i'll tell you which they are") $vRet = ControlCommand("","",$hWnd, "LV_GetSelected", "1") msgbox (0,"LV_GetSelected",$vRet) $vRet = ControlCommand("","",$hWnd, "LV_GetItem", "1", "1") msgbox (0,"LV_GetItem",$vRet) Questions for Jon or anyone else who knows .. 1. I can't seem to get the LV_GetItem command to work. Any ideas? 2. How do I select items: 2,4,6 and 8 .. in one statement? 3. It would be more consistent if the LV_GetSelected referred to items in the same terms as LV_Select: At the moment, LV_GetSelected is zero-based. 4. How do I select an item by name? 5. What other listview commands can I test? And sample syntax please, in the absence of documentation? Thanks for all the hard work in getting us this far .. Everything should be zero based so a get 0,0 will get the first item, 1,1 will select the 2nd subpart of the second item. No way to select by name so far, I didn't know how to do arrange it for usefulness - Should I just filter by item name or filter by subparts etc. You can't select 2,4,6 in one statement - three statements needed (i went with your simple approach) Edited September 6, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 6, 2004 Administrators Share Posted September 6, 2004 (edited) I'm just drawing up a picture that should explain the part/subpart thing (and unless anyone knows any list controls that don't look like this it may be better to rename as items and columns) Edited September 6, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
trids Posted September 6, 2004 Author Share Posted September 6, 2004 (edited) Everything should be zero based so a get 0,0 will get the first item, 1,1 will select the 2nd subpart of the second item. No way to select by name so far, I didn't know how to do arrange it for usefulness - Should I just filter by item name or filter by subparts etc. You can't select 2,4,6 in one statement - three statements needed (i went with your simple approach) <{POST_SNAPBACK}>OK .. cos LV_SelectItem is not zero-based. I would at least like to filter / select by item .. and if you could allow subitem too, then that would be even better! Perhaps you could provide for this using the same terms as the LV_GetText command (which I guess has replaced LV_GetItem?), where: "0" means the listitem itself, and "1" is the first subitem etc. ?? Then you could default to "0" HTH edit: atrocious spelling Edited September 6, 2004 by trids Link to comment Share on other sites More sharing options...
trids Posted September 6, 2004 Author Share Posted September 6, 2004 OK .. cos LV_SelectItem is not zero-based. <{POST_SNAPBACK}>Firstly, I should have said LV_Select (sorry!) .. and i see it is indeed zero-based! My bad :"> Suggestion: Maybe we could have LV_Select accept as input the result of LV_GetSelected .. ? This would allow one to store current selections, fiddle around, and then restore them back again. Also: nice and symmetrical Link to comment Share on other sites More sharing options...
trids Posted September 6, 2004 Author Share Posted September 6, 2004 Any chance of supporting a click on a listview's header? In Windows Explorer and many other apps, this sorts the listview, which would have a significant impact on the targeting of specific listitems. Link to comment Share on other sites More sharing options...
trids Posted September 8, 2004 Author Share Posted September 8, 2004 And (( )) .. Jon, while you're tinkering around with the listview API, can you also please explore the following possibilities:Changing the view format (detail, list, large icon)Positioning icons while in large-icon format: this is especially exciting with regard to writing an au3 script that can remember desktop layout (please please please) Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 13, 2004 Administrators Share Posted September 13, 2004 Are list view controls always made up of just rows and columns? All the ones I've found look like that. If so I will rename the parts/subparts thing to get Rows and Cols which might make things easier. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
trids Posted September 13, 2004 Author Share Posted September 13, 2004 Are list view controls always made up of just rows and columns? All the ones I've found look like that. They have rows and columns .. only if the display format is set to "detail" (or "report", as it's sometimes called) But if a listview is set to "large icon" for example, then you get the typical desktop format (which is in fact a SysListView32 control, according to Au3-spy) .. hence my request about being able to change the position of the icons Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 13, 2004 Administrators Share Posted September 13, 2004 They have rows and columns .. only if the display format is set to "detail" (or "report", as it's sometimes called) But if a listview is set to "large icon" for example, then you get the typical desktop format (which is in fact a SysListView32 control, according to Au3-spy) .. hence my request about being able to change the position of the icons But that essentially works as lots of "rows" with no columns, yeah? You can still select things with the current commands? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
trids Posted September 13, 2004 Author Share Posted September 13, 2004 (edited) Quick answer: yes, i can still select items in "large icon" mode; but i'll have to play some more to see what happens to columns. Hmm .. regardles of the display format, the item-selector number always seems to depend on the sort-order of the listview when in "detail" format. This makes sense, but would need to be carefully documented, as it may not be obvious to everyone. Edited September 13, 2004 by trids Link to comment Share on other sites More sharing options...
trids Posted September 13, 2004 Author Share Posted September 13, 2004 Long answer: Selecting works fine; as does GetText (see code snippet below) ... even when not in report (detail) mode. When in "large icon" mode for example, the column and row references all refer to the underlying report mode. This means that the sort order (and column) of the underlying report mode are significant when selecting by an ordinal number. $sRet = "" for $nX = 0 to $nSubItems $vRet = ControlCommand("","",$hWnd, "LV_GetText", "1", $nX ) $sRet = $sRet & "|" & $vRet next msgbox (0,"LV_GetText",$sRet)How do I select by item name? This doesn't work:$vRet = ControlCommand("","",$hWnd, "LV_Select", "_ WWW.tws")HTH Link to comment Share on other sites More sharing options...
trids Posted September 13, 2004 Author Share Posted September 13, 2004 (edited) Here's an interesting perspective of the dekstop: ;lets explore the desktop ;wait till we click the desktop WinWaitActive("Program Manager") $hWnd = ControlGetHandle("", "", "SysListView321") $nItems = ControlCommand("","",$hWnd, "LV_GetItemCount") $nSubItems = ControlCommand("","",$hWnd, "LV_GetSubItemCount") FileDelete ("C:\desktop.txt") for $nY = 0 to $nItems $sLine = "" for $nX = 0 to $nSubItems ;get the subitem contents $vRet = ControlCommand("","",$hWnd, "LV_GetText", $nY, $nX ) $sLine = $sLine & "|" & $vRet next FileWriteLine("C:\desktop.txt", $sLine) next ;what did we catch? Run (@comspec & " /k ""C:\desktop.txt""", "", @SW_HIDE).. makes you think: is there a way to return the name of the subitem's column name (in the header when the view is set to detail)?((( .. imagine what fun we could have if we could toggle the mode of the desktop to "report view" .. !!! ))) Edited September 13, 2004 by trids Link to comment Share on other sites More sharing options...
dooshorama Posted October 8, 2004 Share Posted October 8, 2004 (edited) thank you jon & trids. your efforts & examples made my life much easier. now questions.. for me LV_gettext & LV_getitem return 1 not the text. what gives? when should we expect updated documentation on the new command in the unstable build? EDIT> i got lv_gettext working in explorer. i just have to figure out what's going on elsewhere. Edited October 8, 2004 by dooshorama Link to comment Share on other sites More sharing options...
Administrators Jon Posted October 8, 2004 Administrators Share Posted October 8, 2004 I think I'm going to move the list view stuff into it's own command, and leave ControlCommand for the simple stuff. ControlListView or something. I'll update the docs when I finish it and some renaming things. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
dooshorama Posted October 8, 2004 Share Posted October 8, 2004 ok. disregard the lv_gettext not working. i figured out what was wrong and it was an embaressingly stupid mistake. Link to comment Share on other sites More sharing options...
this-is-me Posted October 8, 2004 Share Posted October 8, 2004 I had the same stupid mistake when I first used the lv_gettext. Maybe when the docs come out, it would help to have a clearer explanation of how it works. Who else would I be? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now