Xibalba Posted December 15, 2016 Posted December 15, 2016 Hello again dear forum! I want to switch "only text" with "image plus text" in each cell, but can't figure it out. expandcollapse popup#include <GuiConstantsEx.au3> #include <ColorConstants.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) ; GUI Local $StatusBox_Width = 800 Local $StatusBox_Height = 400 Local $hMainGUI = GUICreate("Example", $StatusBox_Width, $StatusBox_Height) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") ; GUI MESSAGE LOOP GUISetState(@SW_SHOW, $hMainGUI) ; LIST VIEW Local $iListView = GUICtrlCreateListView("", 15, 40, 530, 80) _GUICtrlListView_SetExtendedListViewStyle($iListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) ; Load images Local $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($iListView), 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($iListView, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($iListView, "Column 1", 80) _GUICtrlListView_AddColumn($iListView, "Column 2", 80) _GUICtrlListView_AddColumn($iListView, "Column 3", 80) _GUICtrlListView_AddColumn($iListView, "Column 4", 80) _GUICtrlListView_AddColumn($iListView, "Column 5", 80) ; Add items _GUICtrlListView_AddItem($iListView, "One") _GUICtrlListView_AddSubItem($iListView, 0, "", 1, 1) _GUICtrlListView_AddSubItem($iListView, 0, "", 2, 2) GUICtrlCreateListViewItem("1|2|3|4|5", $iListView) MsgBox($MB_SYSTEMMODAL, "Test", "Updating cells...") ; Update cells _GUICtrlListView_SetItem($iListView, "New text", 0, 1) ; OK _GUICtrlListView_SetItem($iListView, "One(1)", 0, 0, 88) ; Here I want to remove the image completely (only way to HIDE image is to put an index that doesn't exist? - 88 in this case) _GUICtrlListView_AddItem($iListView, "Three", 7) ; Here I want to create the text without any image (space) - how? _GUICtrlListView_SetItemImage($iListView, 1, 0, 1) ; OK _GUICtrlListView_SetItemImage($iListView, 0, 1, 2) ; OK While 1 Sleep(100) ; Sleep to reduce CPU usage WEnd Func CLOSEButton() ; Note: At this point @GUI_CtrlId would equal $GUI_EVENT_CLOSE, ; and @GUI_WinHandle would equal $hMainGUI ;MsgBox(0, "GUI Event", "You selected CLOSE! Exiting...") Exit EndFunc ;==>CLOSEButton Basically, see the comments in the code what I want to accomplish (when clicking OK): I want the red box to disappear completely (now bypassed by stating an image index that doesn't exist) I want to create the last row - "Three" - without any image whatsoever. The "OK" comments are the behavior I want to be able to use in certain cases. I'm also puzzled why the value "1" is originally indented while the value "2" is not?! If it matters, I'm running an older version of AutoIt (v3.3.10.2)
LarsJ Posted December 15, 2016 Posted December 15, 2016 I think this is possible, but you need a custom drawn listview. Set up the listview to fit with what you use the most. This seems to be texts only. Then you handle the exceptions (this seems to be both icons and texts) in the custom draw postpaint stage by simply overwriting the texts by icons and texts. You need GDI functions to do that. It's certainly not easy but it can probably be done. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
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