Guest Posted October 26, 2013 Posted October 26, 2013 Hello, i am looking for a way to make a listview with checkboxes and hyperlinks. i found this example: expandcollapse popup#include "GUIListViewSysLink.au3" $hGUI = GUICreate("ListView with SysLink Control!", 420, 530, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX)) $hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS)) GUICtrlCreateListViewItem("AutoIT|C:\Program Files\AutoIt3", $hListView1) GUICtrlCreateListViewItem("Opera|C:\Program Files\Opera", $hListView1) GUICtrlCreateListViewItem("Script|C:\MyScripts", $hListView1) $nSysLinkBkColor = 0xC0C0C0 $nSysLinkStockObject = $LTGRAY_BRUSH $hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS)) GUICtrlCreateListViewItem("Some Name", $hListView2) $hSysLink1 = _GUICtrlListView_SysLinkCreate($hListView1, "AutoIt Script Home Page", "http://autoitscript.com", 0, 2) _GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5) $hSysLink2 = _GUICtrlListView_SysLinkCreate($hListView1, "Opera Home Page", "http://opera.com", 1, 2) _GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5) $hSysLink3 = _GUICtrlListView_SysLinkCreate($hListView1, "My Scripts Home Page?", "http://creator-lab.ucoz.ru", 2, 2) _GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5) $hSysLink1_2 = _GUICtrlListView_SysLinkCreate($hListView2, "Some other Home Page", "http://creator-lab.ucoz.ru", 0, 1) _GUICtrlListView_SysLinkSetFont(-1, "Arial", 10.5) GUICtrlSetBkColor($hListView1, $nSysLinkBkColor) GUICtrlSetBkColor($hListView2, $nSysLinkBkColor) GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 0, 80) GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 2, 120) GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 0, 230) GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 1, 115) ;Here we add ID to the $hSysLink1 _GUICtrlListView_SysLinkSetLinkInfo($hSysLink1, "http://autoitscript.com", "AutoIt") ;And now we check if it was added :) $aInfo = _GUICtrlListView_SysLinkGetLinkInfo($hSysLink1) $sInfo = StringFormat("Info For $hSysLink1:\n\nSysLink State\t\t= %i\nURL\t\t\t= %s\nID\t\t\t= %s\nParent ListView Handle\t= %s", _ $aInfo[1], $aInfo[2], $aInfo[3], $aInfo[4]) ConsoleWrite($sInfo) GUISetState(@SW_SHOW, $hGUI) While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd from here: this example is almost perfect but i also want to add checkboxes. i tried to add $LVS_EX_CHECKBOXES inside the BitOr() in line 32 in the example but it didn't work and no checkboxes was added. Please help me. Thanks
Moderators Melba23 Posted October 26, 2013 Moderators Posted October 26, 2013 gil900,As its name implies, $LVS_EX_CHECKBOXES is an extended style - so you need to put it in the correct place in the parameter list, which is not inside the BitOR for the normal styles. When I do this the checkboxes appear: $hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS), $LVS_EX_CHECKBOXES) $hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS), $LVS_EX_CHECKBOXES)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
Guest Posted October 26, 2013 Posted October 26, 2013 gil900, As its name implies, $LVS_EX_CHECKBOXES is an extended style - so you need to put it in the correct place in the parameter list, which is not inside the BitOR for the normal styles. When I do this the checkboxes appear: $hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS), $LVS_EX_CHECKBOXES) $hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS), $LVS_EX_CHECKBOXES) M23 Ok thank you!It works!I also add this line: GUICtrlSendMsg(-1, (0x1000 + 54), 0x20, 0x20) After the listview line. It solves a problem I do not know how to explain ..I learned this from the Array.au3 udf (in _arraydisplay )
Moderators Melba23 Posted October 26, 2013 Moderators Posted October 26, 2013 gil900,That line is applying the $LVS_EX_FULLROWSELECT extended style to the ListView. If you want to have that style as well as $LVS_EX_CHECKBOXES then I suggest you do this:$hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS)) _GUICtrlListView_SetExtendedListViewStyle($hListView1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) $hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS)) _GUICtrlListView_SetExtendedListViewStyle($hListView2, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))The reason I suggest this is that there are some $WS_EX_* and $LVS_EX_* extended styles that share the same numeric values and if you try to put these $LVS_EX_* extended styles into the GUICtrlCreateListView line they can be misinterpreted and not give the desired results. Using the UDF function actually wraps the GUICtrlSendMsg line you were using - but at least you can understand it a few months later when you re-read the script. 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
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