ufukkreis853 Posted August 19, 2019 Posted August 19, 2019 Hello, good forums to everyone.In Autoit, there is a color change when doing $gui_disable. I dont want this. when I press the "lock button", I want to lock "Listview" along with the "lock button". In doing so, I would like to get green after pressing the "button" and "listview" lock button, which were the previous color blue. note : i use google translation, sorry for my bad english #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 470, 500) $hLV = GUICtrlCreateListView("test 1", 10, 10, 450, 400) GUICtrlSetBkColor(-1, 0x00FFFF) $hButton = GUICtrlCreateButton("lock", 10, 450, 80, 30) GUICtrlSetBkColor(-1, 0x00FFFF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) Sleep(1000) GUICtrlSetBkColor($hButton, 0x00FF00) ; working GUICtrlSetColor($hButton, 0x00FFFF) ; not working GUICtrlSetData($hButton, "locked") GUICtrlSetState($hLV, $GUI_DISABLE) Sleep(1000) GUICtrlSetBkColor($hLV, 0x00FF00) ; working GUICtrlSetColor($hLV, 0x00FFFF) ; not working EndSwitch WEnd
Zedna Posted August 19, 2019 Posted August 19, 2019 (edited) Just little playing with you example: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 470, 500) $hLV = GUICtrlCreateListView("test 1", 10, 10, 450, 400) GUICtrlCreateListViewItem("item1", $hLV) GUICtrlSetBkColor(-1, 0x00FFFF) $hButton = GUICtrlCreateButton("lock", 10, 450, 80, 30) GUICtrlSetBkColor(-1, 0x00FFFF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) ;~ Sleep(1000) GUICtrlSetBkColor($hButton, 0x00FF00) ; working GUICtrlSetColor($hButton, 0x00FFFF) ; not working GUICtrlSetData($hButton, "locked") ;~ GUICtrlSetState($hLV, $GUI_DISABLE) ;~ Sleep(1000) GUICtrlSetBkColor($hLV, 0x00FF00) ; working ;~ GUICtrlSetColor($hLV, 0x00FFFF) ; not working GUICtrlCreateListViewItem("item2", $hLV) ;~ GUICtrlSetColor($hLV, 0x00FFFF) ; not working GUICtrlSetColor($hLV, 0xFF0000) ; working GUICtrlCreateListViewItem("item3", $hLV) EndSwitch WEnd As you can see when not doing disable ListView all works OK because disabling override background color to gray. So if you want to change colors of ListView DON'T disable ListView. Edited August 19, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
ufukkreis853 Posted August 19, 2019 Author Posted August 19, 2019 2 hours ago, Zedna said: Just little playing with you example: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 470, 500) $hLV = GUICtrlCreateListView("test 1", 10, 10, 450, 400) GUICtrlCreateListViewItem("item1", $hLV) GUICtrlSetBkColor(-1, 0x00FFFF) $hButton = GUICtrlCreateButton("lock", 10, 450, 80, 30) GUICtrlSetBkColor(-1, 0x00FFFF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) ;~ Sleep(1000) GUICtrlSetBkColor($hButton, 0x00FF00) ; working GUICtrlSetColor($hButton, 0x00FFFF) ; not working GUICtrlSetData($hButton, "locked") ;~ GUICtrlSetState($hLV, $GUI_DISABLE) ;~ Sleep(1000) GUICtrlSetBkColor($hLV, 0x00FF00) ; working ;~ GUICtrlSetColor($hLV, 0x00FFFF) ; not working GUICtrlCreateListViewItem("item2", $hLV) ;~ GUICtrlSetColor($hLV, 0x00FFFF) ; not working GUICtrlSetColor($hLV, 0xFF0000) ; working GUICtrlCreateListViewItem("item3", $hLV) EndSwitch WEnd As you can see when not doing disable ListView all works OK because disabling override background color to gray. So if you want to change colors of ListView DON'T disable ListView. Is there no way to lock Listview without making $gui_disable? Because I have to lock Listview . The code you write doesn't lock in Listview, it just changes color.
Nine Posted August 19, 2019 Posted August 19, 2019 I believe (really not sure) it could be doable by creating a second $WS_POPUP, $WS_EX_MDICHILD GUI that overlapped the first containing only the listview and when you press Lock button, it would disable the whole second GUI. Untested, and don't have time to do it right now. Maybe tomorrow... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
ufukkreis853 Posted August 20, 2019 Author Posted August 20, 2019 17 hours ago, Nine said: I believe (really not sure) it could be doable by creating a second $WS_POPUP, $WS_EX_MDICHILD GUI that overlapped the first containing only the listview and when you press Lock button, it would disable the whole second GUI. Untested, and don't have time to do it right now. Maybe tomorrow... ı wait you
Nine Posted August 20, 2019 Posted August 20, 2019 7 hours ago, ufukkreis853 said: ı wait you Don't hold your breath “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
KickStarter15 Posted August 27, 2019 Posted August 27, 2019 @ufukkreis853, Not sure if this is what you want.😊 Try. #Include <GUIEdit.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 470, 500) $hLV = GUICtrlCreateListView("test 1", 10, 10, 450, 400, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) _GUICtrlEdit_SetLimitText($hLV, 64000) _GUICtrlEdit_LineScroll($hLV, 0, _GUICtrlEdit_GetLineCount($hLV)) GUICtrlSetBkColor(-1, 0x00FFFF) $hButton = GUICtrlCreateButton("lock", 10, 450, 80, 30) GUICtrlSetBkColor(-1, 0x00FFFF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) Sleep(1000) GUICtrlSetBkColor($hButton, 0x00FF00) ; working GUICtrlSetColor($hButton, 0x00FFFF) ; not working GUICtrlSetData($hButton, "locked") Sleep(1000) GUICtrlSetBkColor($hLV, 0x00FF00) ; working GUICtrlSetColor($hLV, 0x00FFFF) ; not working EndSwitch WEnd Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
ufukkreis853 Posted August 28, 2019 Author Posted August 28, 2019 23 hours ago, KickStarter15 said: @ufukkreis853, Not sure if this is what you want.😊 Try. #Include <GUIEdit.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 470, 500) $hLV = GUICtrlCreateListView("test 1", 10, 10, 450, 400, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) _GUICtrlEdit_SetLimitText($hLV, 64000) _GUICtrlEdit_LineScroll($hLV, 0, _GUICtrlEdit_GetLineCount($hLV)) GUICtrlSetBkColor(-1, 0x00FFFF) $hButton = GUICtrlCreateButton("lock", 10, 450, 80, 30) GUICtrlSetBkColor(-1, 0x00FFFF) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) Sleep(1000) GUICtrlSetBkColor($hButton, 0x00FF00) ; working GUICtrlSetColor($hButton, 0x00FFFF) ; not working GUICtrlSetData($hButton, "locked") Sleep(1000) GUICtrlSetBkColor($hLV, 0x00FF00) ; working GUICtrlSetColor($hLV, 0x00FFFF) ; not working EndSwitch WEnd not this, because ı want lock listview
KickStarter15 Posted August 29, 2019 Posted August 29, 2019 22 hours ago, ufukkreis853 said: not this, because ı want lock listview What do you mean by locking listview? Can you explain the locking that you want? kind of floating ideas here.😊 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
Inpho Posted September 2, 2019 Posted September 2, 2019 (edited) _GUICtrlListView_BeginUpdate() _GUICtrlListView_EndUpdate() ? EDIT: I see my answer doesn't fit the question properly. @ufukkreis853 Wouldn't it be more logical to leave the listview grey when disabled; so that the message is conveyed to the user that the listview is locked rather than the program being frozen? Personally, I have a few flavours depending on the application: 1. Empty the listview of data and headers so it's just a blank rectangle. 2. As with 1, but with a loading symbol if the operation takes longer than half a second or so. 3. Lock every control. 4. Hide the original control, and show an empty one in its place while necessary. I only do this if removal of data is unnecessary. Edited September 2, 2019 by Inpho
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