shEiD Posted March 29, 2011 Share Posted March 29, 2011 (edited) Hi,I would like to create a listview with no border, no column headers and custom color. I've tried creating a listview control in two different ways, but couldn't get the wanted result Help please.expandcollapse popup; My example Gui #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListviewConstants.au3> #include <GuiListView.au3> Global Const $COLOR_GUI = 0x494E49 Global Const $COLOR_TEXT = 0xE6ECE0 $GUI = GUICreate('test', 300, 500, -1, -1) GUISetBkColor($COLOR_GUI) ; ======================= ListView 1 ; everything works, except: ; how can I remove the border (or change it's color) $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, $LVS_NOCOLUMNHEADER) GUICtrlSetBkColor(-1, $COLOR_GUI) GUICtrlSetColor(-1, $COLOR_TEXT) $item1 = GUICtrlCreateListViewItem("test|col22|col23", $listview) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) _GUICtrlListView_SetColumnWidth($listview, 0, 100) _GUICtrlListView_SetColumnWidth($listview, 1, 100) _GUICtrlListView_SetOutlineColor($listview, $COLOR_GUI) ; ======================= ListView 2 ; cool, does not have a border, but: $hListView = _GUICtrlListView_Create($GUI, "col1|col2|col3", 10, 220, 280, 200, $LVS_NOCOLUMNHEADER) _GUICtrlListView_SetBkColor($hListView, $COLOR_GUI) _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) ; <--------------------- Does NOT work! _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2) ; <------------ Does NOT work! _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) ; <--------------------- Does NOT work! _GUICtrlListView_SetColumnWidth($hListView, 0, 250) ; <------------------------- Does NOT work! GUISetState(@SW_SHOW) While 1 $eMSG = GUIGetMsg() Switch $eMSG Case -3 Exit EndSwitch WEndGui screenshot: Edited March 29, 2011 by shEiD Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2011 Moderators Share Posted March 29, 2011 shEiD, I can do it for the UDF ListView but not for the native one: expandcollapse popup; My example Gui #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListviewConstants.au3> #include <GuiListView.au3> Global Const $COLOR_GUI = 0x494E49 Global Const $COLOR_TEXT = 0xE6ECE0 $GUI = GUICreate('test', 300, 500, -1, -1) GUISetBkColor($COLOR_GUI) ; ======================= ListView 1 ; everything works, except: ; how can I remove the border (or change it's color) $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, $LVS_NOCOLUMNHEADER) GUICtrlSetBkColor(-1, $COLOR_GUI) GUICtrlSetColor(-1, $COLOR_TEXT) $item1 = GUICtrlCreateListViewItem("test|col22|col23", $listview) $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) _GUICtrlListView_SetColumnWidth($listview, 0, 90) _GUICtrlListView_SetColumnWidth($listview, 1, 90) ; ======================= ListView 2 ; You needed to add a few styles <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $hListView = _GUICtrlListView_Create($GUI, "", 10, 220, 280, 200, BitOr($LVS_REPORT,$LVS_NOCOLUMNHEADER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetBkColor($hListView, $COLOR_GUI) _GUICtrlListView_SetTextBkColor($hListView, $COLOR_GUI) _GUICtrlListView_SetTextColor($hListView, $COLOR_TEXT) _GUICtrlListView_AddColumn($hListView, "Col 1", 90) _GUICtrlListView_AddColumn($hListView, "Col 2", 90) _GUICtrlListView_AddColumn($hListView, "Col 3", 90) _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2) _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) GUISetState(@SW_SHOW) While 1 $eMSG = GUIGetMsg() Switch $eMSG Case -3 Exit EndSwitch WEnd I will keep thinking about the native one. 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...
shEiD Posted March 29, 2011 Author Share Posted March 29, 2011 (edited) shEiD,I can do it for the UDF ListView but not for the native one: I will keep thinking about the native one. M23 Thank YOU. I've spent hours on this trying this and that, searching the forums and chm, nothing worked. Just out of curiosity, did I miss this solution in the help.chm? I mean I still don't get it, which style fixed the problem with the rows not showing. Oh, and 1 more thing I forgot before: is there a way to change "selection" color? I mean, the default blue color does not look good with this gui color... Edited March 29, 2011 by shEiD Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2011 Moderators Share Posted March 29, 2011 shEiD,You needed to add the $LVS_REPORT style and create the columns using _GUICtrlListView_AddColumn. As to the selected colour, that is a system colour that I imagine you can change in Control Panel - but it will then apply to the whole system, which may not be what you want. 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...
shEiD Posted March 29, 2011 Author Share Posted March 29, 2011 @Melba23 Thanks again for the answers and help. If you think of way to achieve this via native listview, please lemme know. Marking topic as solved. Link to comment Share on other sites More sharing options...
rover Posted April 5, 2011 Share Posted April 5, 2011 The default native listview extended styles are $WS_EX_CLIENTEDGE and $WS_EX_TRANSPARENT, as reported by Winspector Spy. Removing the $WS_EX_CLIENTEDGE style to eliminate the border. $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, _ BitOR($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER), $WS_EX_TRANSPARENT) I see fascists... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2011 Moderators Share Posted April 5, 2011 rover, Hi! I could have sworn I had tried that - but obviously not. Thanks as always. 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