Tipsy Posted December 21, 2010 Share Posted December 21, 2010 Hello, i'm new to autoit and i love it. i was trying to change this code i found but i cannot make it work with "GUICtrlSetStyle($iLV, $LVS_ICON)". please advise. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <SendMessage.au3> Global $hGui, $iLV, $iMark, $Msg, $iIndex = 0 $hGui = GUICreate(":-)", 400, 300) $iLV = GUICtrlCreateListView("Column 1", 5, 5, 300, 290) GUICtrlSetStyle($iLV, $LVS_ICON) _GUICtrlListView_SetExtendedListViewStyle($iLV, $LVS_EX_BORDERSELECT) For $i = 0 To 9 GUICtrlCreateListViewItem($i & ") Item", $iLV) Next $iMark = GUICtrlCreateButton("Set Mark", 310, 120, 85, 25) GUISetState(@SW_SHOW, $hGui) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $iMark If $iIndex = _GUICtrlListView_GetItemCount($iLV) Then $iIndex = 0 _LV_InsertMark($iLV, $iIndex) $iIndex += 1 EndSwitch WEnd Func _LV_InsertMark($hListView, $iIndex) Local $tLVIMARK, $hLV $tLVIMARK = DllStructCreate("uint cbSize;dword dwFlags;int iItem;dword dwReserved") DllStructSetData($tLVIMARK, "cbSize", DllStructGetSize($tLVIMARK)) DllStructSetData($tLVIMARK, "dwFlags", $LVIM_AFTER) DllStructSetData($tLVIMARK, "iItem", $iIndex) DllStructSetData($tLVIMARK, "dwReserved", 0) $hLV = $hListView If Not IsHWnd($hLV) Then $hLV = GUICtrlGetHandle($hListView) $r = _SendMessage($hLV, $LVM_SETINSERTMARK, 0, DllStructGetPtr($tLVIMARK)) ConsoleWrite($r&" "&DllStructGetPtr($tLVIMARK)&@CRLF) EndFunc ;==>_LV_InsertMark Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 21, 2010 Moderators Share Posted December 21, 2010 Tipsy,Welcome to the AutoIt forum. If I set the $LVS_ICON style as I create the ListView, everything seems to work as normal:$iLV = GUICtrlCreateListView("Column 1", 5, 5, 300, 290, $LVS_ICON) ;GUICtrlSetStyle($iLV, $LVS_ICON) _GUICtrlListView_SetExtendedListViewStyle($iLV, $LVS_EX_BORDERSELECT)Does that solve your problem? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tipsy Posted December 21, 2010 Author Share Posted December 21, 2010 Tipsy, Welcome to the AutoIt forum. If I set the $LVS_ICON style as I create the ListView, everything seems to work as normal: $iLV = GUICtrlCreateListView("Column 1", 5, 5, 300, 290, $LVS_ICON) ;GUICtrlSetStyle($iLV, $LVS_ICON) _GUICtrlListView_SetExtendedListViewStyle($iLV, $LVS_EX_BORDERSELECT) Does that solve your problem? M23 thanks but with that i won't be able to create a thumbnail type view. for some reason when you use the style after you create i'm getting the view i want. thanks you very much for your help. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 21, 2010 Moderators Share Posted December 21, 2010 Tipsy,I see the problem now I have played with it a bit more. MSDN does say that the LVM_SETINSERTMARK message should work with icon view - but it does not seem to as you have discovered. A Windows or an AutoIt problem? Well beyond me to say, I am afraid. Sorry I cannot be more helpful - I will try harder next time. M23P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rover Posted December 21, 2010 Share Posted December 21, 2010 these functions are undocumented in GuiListView.au3 _GUICtrlListView_SetInsertMark _GUICtrlListView_SetInsertMarkColor works with $LVS_AUTOARRANGE style expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <SendMessage.au3> Global $hGui, $iLV, $iMark, $Msg, $iIndex = 0 $hGui = GUICreate(":-)", 400, 300) $iLV = GUICtrlCreateListView("Column 1", 5, 5, 300, 290) GUICtrlSetStyle($iLV, BitOR($LVS_AUTOARRANGE, $LVS_ICON)) _GUICtrlListView_SetExtendedListViewStyle($iLV, $LVS_EX_BORDERSELECT) For $i = 0 To 9 GUICtrlCreateListViewItem($i & ") Item", $iLV) Next $iMark = GUICtrlCreateButton("Set Mark", 310, 120, 85, 25) GUISetState(@SW_SHOW, $hGui) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $iMark If $iIndex = _GUICtrlListView_GetItemCount($iLV) Then $iIndex = 0 ;_LV_InsertMark($iLV, $iIndex) _GUICtrlListView_SetInsertMark($iLV, $iIndex, False);insert before (False) or after (True) item $iIndex += 1 _GUICtrlListView_SetInsertMarkColor($iLV, 0xFF0000) EndSwitch WEnd Func _LV_InsertMark($cListView, $iIndex) Local $tLVIMARK $tLVIMARK = DllStructCreate("uint cbSize;dword dwFlags;int iItem;dword dwReserved") DllStructSetData($tLVIMARK, "cbSize", DllStructGetSize($tLVIMARK)) DllStructSetData($tLVIMARK, "dwFlags", $LVIM_AFTER) DllStructSetData($tLVIMARK, "iItem", $iIndex) DllStructSetData($tLVIMARK, "dwReserved", 0) $iRet = GUICtrlSendMsg($cListView, $LVM_SETINSERTMARK, 0, DllStructGetPtr($tLVIMARK)) ;ConsoleWrite($iRet&" "&DllStructGetPtr($tLVIMARK)&@CRLF) EndFunc ;==>_LV_InsertMark I see fascists... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 21, 2010 Moderators Share Posted December 21, 2010 rover, I just knew someone clever would come along with the answer - might have guessed it would be you! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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