wese85 Posted August 31, 2021 Posted August 31, 2021 Hello, GUICtrlSetState($frm7_Combo9,$GUI_DISABLE) GUICtrlSetState($frm7_Button1,$GUI_DISABLE) GUICtrlSetState($frm7_Input1,$GUI_DISABLE) is there a way to lock controls without graying out the control's font and background? thanks in advance
Nine Posted August 31, 2021 Posted August 31, 2021 Try to access the input box #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPIConv.au3> Example() Func Example() Global $hWnd = GUICreate(" My GUI input acceptfile") Global $idInput = GUICtrlCreateInput("Test", 10, 5, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = _WinAPI_LoWord($wParam), $iCode = _WinAPI_HiWord($wParam) If $iCode = $EN_SETFOCUS And $iIDFrom = $idInput Then ControlSend($hWnd, "", "", "{TAB}") Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Just set a boolean to make the input box available or not... “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 Interface Object based on Tag
Zedna Posted August 31, 2021 Posted August 31, 2021 For input type control: $ed1 = GUICtrlCreateInput("123", 10, 10, 50, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY)) GUICtrlSetBkColor(-1, 0xFFFFFF) Resources UDF ResourcesEx UDF AutoIt Forum Search
Nine Posted August 31, 2021 Posted August 31, 2021 (edited) @Zedna Good point. But I was trying to emulate a disabled item without disabling it. The same strategy can be applied to other controls : expandcollapse popup#include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPIConv.au3> Example() Func Example() Global $hWnd = GUICreate(" My GUI input acceptfile") Global $idInput = GUICtrlCreateInput("Disabled", 10, 5, 300, 20) Global $idCombo = GUICtrlCreateCombo("", 10, 30, 185, 20) GUICtrlSetData(-1,"Item 1|Item 2|Item3", "Item 1") Global $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20, $BS_NOTIFY) Global $idEnable = GUICtrlCreateInput("Enabled", 10, 125, 300, 20) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = _WinAPI_LoWord($wParam), $iCode = _WinAPI_HiWord($wParam) If ($iCode = $BN_SETFOCUS And $iIDFrom = $idBtn) Or ($iCode = $EN_SETFOCUS And $iIDFrom = $idInput) or _ ($iCode = $CBN_SETFOCUS And $iIDFrom = $idCombo) Then ControlSend($hWnd, "", "", "{TAB}") Return 1 EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Not perfect but best I could think of... Edited August 31, 2021 by Nine “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 Interface Object based on Tag
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