middae Posted October 27, 2009 Share Posted October 27, 2009 So I've looked through help file, and ran over the forum; but haven't found an answer (or didn't see it) to the following question: ProgramA (not an AutoIt gui) has a listbox, and I have the $hwnd to that listbox. This list has several columns with headers. Is there a way to send a command, besides mouseclicking, to Sort the list by the Second column? Link to comment Share on other sites More sharing options...
middae Posted October 27, 2009 Author Share Posted October 27, 2009 I'm hoping I'm not relegated to OCRing across the screen until I find a good pxchksum and then mouseclicking there. =/ _GuiCtrlListBox_Sort doesn't offer a way to sort by column. =/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 27, 2009 Moderators Share Posted October 27, 2009 ListBox by column? Do you mean ListView? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Zedna Posted October 27, 2009 Share Posted October 27, 2009 I'm hoping I'm not relegated to OCRing across the screen until I find a good pxchksum and then mouseclicking there. =/ _GuiCtrlListBox_Sort doesn't offer a way to sort by column. =/ It's probably ListView and not Listbox. It should be possible by sending WM_NOTIFY message with properly filled struct NMLISTVIEW as parameter (pointer). Here is piece of code from one of my projects. Here I need to sort my ListView at startup by first column so I call this function Func DoSort() $struct_NMLISTVIEW = DllStructCreate("hwnd;uint;uint;int;int;uint;uint;uint;int;int;int") DllStructSetData($struct_NMLISTVIEW,1,GUICtrlGetHandle($ListView1)) DllStructSetData($struct_NMLISTVIEW,2,$ListView1) DllStructSetData($struct_NMLISTVIEW,3,$LVN_COLUMNCLICK) DllStructSetData($struct_NMLISTVIEW,4,-1) ; item = -1 DllStructSetData($struct_NMLISTVIEW,5,0) ; subitem=0 _SendMessage($Form1, $WM_NOTIFY, $ListView1, DllStructGetPtr($struct_NMLISTVIEW)) $struct_NMLISTVIEW = 0 EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
middae Posted October 28, 2009 Author Share Posted October 28, 2009 Yes, sorry, I get my ListBox and ListView mixed up. It's a ListView. ColA | ColB | ColC | ColdD Data | Data1 | Data | Data Data | Data2 | Data | Data Data | Data3 | Data | Data I'm trying to click Column Header (or send some Sort_Descending command) for ColB to make it in Descending order ColA | ColB | ColC | ColdD Data | Data3 | Data | Data Data | Data2 | Data | Data Data | Data1 | Data | Data Reading your code, I assume $Struct is a created type, and that the uint's are ..how many columns the listview has? Link to comment Share on other sites More sharing options...
Zedna Posted October 28, 2009 Share Posted October 28, 2009 Reading your code, I assume $Struct is a created type, and that the uint's are ..how many columns the listview has?No. These uints must stay as they are without any change.Just modify DllStructSetData part.Also notice my example is for sending message to ListView inside my own GUI.For external GUI you probably must allocate memory inside external application memory spaceand copy structure content into it.Search forum for more details about these techniques. You may also look at sources of ListView UDFs there are very nice examples of sending messages to ListView controls inside external applications. Resources UDF ResourcesEx UDF AutoIt Forum Search 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