September Posted July 27, 2022 Posted July 27, 2022 I have two tabs, which are TAB_1 and TAB_2, there are two EDIT controls, one in TAB_1, another in TAB_2, respectively. My question is, how to know which EDIT control is active?---I mean, to know which one is in front? I tried GUICtrlGetState, but two EDIT controls return 80, I also tried GUICtrlRead($tab), but nothing return.
Luke94 Posted July 27, 2022 Posted July 27, 2022 You could use ControlCommand to check if the Edit is visible? If ControlCommand($hGUI, '', ControlGetHandle($hGUI, '', $Edit_1), 'IsVisible') = 1 Then ConsoleWrite('Edit_1 is visible' & @CRLF) ElseIf ControlCommand($hGUI, '', ControlGetHandle($hGUI, '', $Edit_2), 'IsVisible') = 1 Then ConsoleWrite('Edit_2 is visible' & @CRLF) EndIf If you're wanting to know which tab is selected, you could use _GUICtrlTab_GetCurSel. #include <GuiTab.au3> Local $iCurSel = _GUICtrlTab_GetCurSel($Tab_1)
September Posted July 27, 2022 Author Posted July 27, 2022 29 minutes ago, Luke94 said: You could use ControlCommand to check if the Edit is visible? If ControlCommand($hGUI, '', ControlGetHandle($hGUI, '', $Edit_1), 'IsVisible') = 1 Then ConsoleWrite('Edit_1 is visible' & @CRLF) ElseIf ControlCommand($hGUI, '', ControlGetHandle($hGUI, '', $Edit_2), 'IsVisible') = 1 Then ConsoleWrite('Edit_2 is visible' & @CRLF) EndIf If you're wanting to know which tab is selected, you could use _GUICtrlTab_GetCurSel. #include <GuiTab.au3> Local $iCurSel = _GUICtrlTab_GetCurSel($Tab_1) Great, that's what I need, thanks.
Nine Posted July 27, 2022 Posted July 27, 2022 5 hours ago, September said: I also tried GUICtrlRead($tab), but nothing return. I highly doubt that. See example : #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("Test") Local $tab = GUICtrlCreateTab(10, 10, 400, 400) GUICtrlCreateTabItem("tab0") GUICtrlCreateEdit("ed1", 20, 40, 250, 250) GUICtrlCreateTabItem("tab1") GUICtrlCreateEdit("ed2", 20, 40, 250, 250) GUICtrlCreateTabItem("") GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop ConsoleWrite(GUICtrlRead($tab) & @CRLF) WEnd EndFunc ;==>Example “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