Der_Andi Posted October 11, 2010 Share Posted October 11, 2010 Hi all, I've got a listview with three columns. The first two columns have a width of 0, so they are hidden. But when I add new items, the second column gets visible. The first column stays hidden. How can I prevent the second column from getting visible? Just setting it to 0 again seems to be not right for me. Here's an example, demonstrating the problem: #include <GuiConstantsEx.au3> #include <GuiListView.au3> GUICreate("", 400, 300) $hListView = GUICtrlCreateListView("||items", 2, 2, 394, 268) _GUICtrlListView_SetColumnWidth($hListView, 0, 0) _GUICtrlListView_SetColumnWidth($hListView, 1, 0) GUICtrlCreateListViewItem("hidden|hidden|visible", $hListView) GUICtrlCreateListViewItem("hidden|hidden|visible", $hListView) GUICtrlCreateListViewItem("hidden|hidden|visible", $hListView) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Der_Andi Posted October 11, 2010 Author Share Posted October 11, 2010 (edited) Not sure if this is what you looking for : ;... GUICtrlCreateListViewItem("||visible", $hListView) GUICtrlCreateListViewItem("||visible", $hListView) GUICtrlCreateListViewItem("||visible", $hListView) ;... Eh... is this a joke? :-P Seriously, why would I create two hidden columns and leave them empty? Edited October 11, 2010 by Der_Andi Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 11, 2010 Moderators Share Posted October 11, 2010 Der_Andi, I am afraid I have not come up with anything better than rehiding the column each time you add an item. Why do you want to have the first 2 columns hidden? Perhaps there is another way to do this. 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...
PsaltyDS Posted October 11, 2010 Share Posted October 11, 2010 Don't mix the native AutoIt GUI functions with the UDF functions if you can help it. It works fine if you use the UDF throughout: #include <GuiConstantsEx.au3> #include <GuiListView.au3> $hGUI = GUICreate("", 400, 300) $hListView = _GUICtrlListView_Create($hGUI, "hidden|hidden|visible", 10, 10, 380, 280) _GUICtrlListView_SetColumnWidth($hListView, 0, 0) _GUICtrlListView_SetColumnWidth($hListView, 1, 0) For $n = 0 To 3 _GUICtrlListView_AddItem($hListView, $n & "-0 hidden") _GUICtrlListView_AddSubItem($hListView, $n, $n & "-1 hidden", 1) _GUICtrlListView_AddSubItem($hListView, $n, $n & "-2 visible", 2) Next GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Der_Andi Posted October 11, 2010 Author Share Posted October 11, 2010 Interesting! I didn't know that mixing native functions with UDF's can have such negative effects. I've been doing this ever since and everything worked out so far. Thanks for the tip, PSalty. @Melba: I hope, it is okay with you, if I just use this solution. It would have been quite a story just to cover the basics of my program ;-) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 11, 2010 Moderators Share Posted October 11, 2010 Der_Andi, Of course! I was just looking for an alternative solution, but our resident waterfowl has come up with one for us. 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...
Der_Andi Posted October 11, 2010 Author Share Posted October 11, 2010 (edited) I'd like to add, that there is indeed a way, how you can mix native GUI functions with UDF's. When using UDF's, make sure you use the handle of the control. Then it works, too. Or in my case: column widths do not change. Creating listviews with _GUICtrlListView_Create() has one drawback: they are not affected by GUISetFont. So I found the clue in this thread: http://www.autoitscript.com/forum/index.php?showtopic=70077&view=findpost&p=513807 Edited October 11, 2010 by Der_Andi 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