LarsJ Posted July 3, 2021 Author Share Posted July 3, 2021 (edited) ListView ComboA ListView Combo is created by replacing the original ListBox with a ListView. Replacement of the controls is mainly implemented through the subclassing technique. Only a small amount of owner draw code is used. Because much of the code depends on the functionality of the ListView, and because the functionality will obviously differ from one example to another, it's not easy to create a set of general functions in a UDF. However, it should be possible to implement if not all then some of the functions in a UDF. So there may come an update, with some of the functions coded in a UDF. In the absence of a UDF in this version the example is created with quite a lot of different ListView functionality, so that it contains most of the code you may need. The functionality includes: Create item and subitem checkboxes Disable focused and selected states Create Edit control to edit cell texts The ListView is created in the "Case $WM_USER" section of Examples\ListViewCombo.au3. The ListView is a virtual ListView that's feeded with data from the $g_aLVData array. Because the ListView in a ListView Combo isn't open all the time, a ListView Combo works best if the ListView plays a minor role in the entire GUI. E.g. if the ListView is used to select settings or options used in the rest of the GUI. The big advantage of a ListView Combo is that it doesn't take up much space when the ListView is closed. The images shows a closed and open ListView Combo: The texts in the last column can be edited through an Edit control. Click to open the Edit control. Move the mouse out of the Edit control to close it. Tomorrow I'll show an example of how to use a ListView Combo control. 7z-file The 7z-file contains source code for the example. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. ListViewCombo.7z Edited July 3, 2021 by LarsJ Skysnake and mLipok 2 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 Link to comment Share on other sites More sharing options...
ermar Posted January 13, 2022 Share Posted January 13, 2022 Hi Lars, I find this feature The Checkbox Combo great for my needs. It's exactly what I was looking for. I might ask a dumb question but I don't know how to refresh the values of this Checkbox Combo like the GUICtrlSetData function would do with GUICtrlCreateCombo. In my program, there is a processing that generates a list of values and these values should be available in this The Checkbox Combo to select the ones I want. In the examples files, the variable $aItems is initialized at the beginning so the Checkbox Combo displays the values correctly. In my program, at the beginning my variable is null, and it is a treatment that I would launch which will value my variable. thank you for the help. regards Eric Link to comment Share on other sites More sharing options...
LarsJ Posted January 14, 2022 Author Share Posted January 14, 2022 In the Checkbox Combo control it isn't possible to update items. Instead, you can delete and recreate the control as demonstrated in the Create and Delete.au3 example. Use a 2d array to preserve any checked items. It's also not possible to create a Checkbox Combo without items. Use the standard Combo control instead. 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 Link to comment Share on other sites More sharing options...
ermar Posted January 18, 2022 Share Posted January 18, 2022 Thanks Larsj, In fact, I had thought of using the CheckboxCombo_Delete function because in my program there are several tabs, and once I apply the treatment (button Action) to feed the variable, if I select another tab I find the CheckboxCombo always overlaid. I had thought of putting this CheckboxCombo_Delete function from the beginning in the other tabs hoping that it would delete the CheckboxCombo, but it doesn't work 😞 Moreover to make the CheckboxCombo appears with values after having activated the button Action, I must repeat 2 times : CheckboxCombo_create. The behavior is strange, I don't know if my programming is incorrect for the use. This is a test : expandcollapse popup#include <GUIConstantsEx.au3> #include <CheckboxCombo.au3> Opt("GUIOnEventMode", 1) FormMain () Main() Func FormMain () Global $GesADPC = GUICreate("Test", 225, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "GesADPCClose") Global $Tab1 = GUICtrlCreateTab(0, 0, 220, 244) Global $TabSheet1 = GUICtrlCreateTabItem("Tab1") ;Local $aItems = '' global $idComboBox ; Create Checkbox Combo ;$idComboBox = CheckboxCombo_Create( 10, 60, 200, 20, 10, $aItems ) global $idCreate1 = GUICtrlCreateButton( "Action", 10, 100, 79, 22 ) GUICtrlSetOnEvent(-1, "CheckboxCHGT") Global $Tab2 = GUICtrlCreateTabItem("Tab2") ;CheckboxCombo_Delete( $idComboBox ) GUICtrlCreateTabItem("");fin de la définition de TabItem GUISetState(@SW_SHOW) EndFunc Func Main();permet de faire afficher la fenetre du produit While 1 Sleep(500) WEnd Exit EndFunc ;==>Main Func GesADPCClose() Exit EndFunc ;==>GestscriptClose func CheckboxCHGT() ; Local $aItems = [ "I0", "I1", "I2", "I3", "I4"] local $aItems = [ [ "Item0" ], _ [ "Item1" ], _ [ "Item2", 1 ], _ ; Item2 is checked [ "Item3" ], _ [ "Item4", 1 ], _ ; Item4 is checked [ "Item5" ], _ [ "Item6", 1 ], _ ; Item6 is checked [ "Item7" ], _ [ "Item8" ], _ [ "Item9" ] ] ;local $idComboBox ;CheckboxCombo_Delete( $idComboBox ) $idComboBox = CheckboxCombo_Create( 10, 60, 200, 20, 10, $aItems ) $idComboBox = CheckboxCombo_Create( 10, 60, 200, 20, 10, $aItems ) EndFunc I tried the other program Listview Combo and I get 2 issues : error: _WinAPI_GetCurrentThreadId(): undefined function error: _WinAPI_UnhookWindowsHookEx(): undefined function. I managed to correct one error by adding #include <WinAPIProc.au3> but this error: _WinAPI_GetCurrentThreadId(): undefined function is still there. An idea ? I use the last version 3.14.5. Regards Eric Link to comment Share on other sites More sharing options...
ermar Posted February 7, 2022 Share Posted February 7, 2022 Hi, no news, i'm come back 🙂 Using the tabs does not allow to fully use this function checkbox combo ? or this is a bad code in my programming ? if not, is it possible to have a combo box with the possibility to select several items ? after many searches, they prove to be unsuccessful. I may not be going in the right way with a combobox ? an advice ? Thank you for help. regards Eric Link to comment Share on other sites More sharing options...
ermar Posted February 22, 2022 Share Posted February 22, 2022 Hi , For those who are interested I found out why I was getting error messages with the Listview Combo. the following include is missing : #include <WinAPI.au3> Well that doesn't solve my initial problem but at least I can make this script work 🙂 regards 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