Jump to content

Recommended Posts

Posted

When I look at the window hierarchy from a tool such as System Informer, I can't tell directly whether or not a control is within a tab control. By that, I mean that it does not show the tab control as being the parent of the control.

Does anyone have any tricks to know, for certain, that a control is within a tab control?

I don't need to know which tab specifically. Just whether it is within the tab control or not.

I have an example with "Checkbox 1" which is within the tab control. And "Checkbox 2" which is not within the tab control. If anyone can help with this, I would really appreciate it. Thank you. :)

I assume that you have to determine region or rect for the tab control and same for the other controls to determine if they overlap. Regions and rect measurements are still above my understanding. Or at least a bit fuzzy still.

By the way, for the purpose of this example I am using checkboxes. But realistically, it could be any type of control within the tab control.

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    GUICreate("My GUI Tab")

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $idTab = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateCheckbox("Checkbox 1", 20, 50)
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateCheckbox("Checkbox 2", 20, 150)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

 

Posted (edited)

I hope, here is better base script:

;~ https://www.autoitscript.com/forum/topic/213665-how-can-i-detect-if-a-control-is-within-a-tab-control

#AutoIt3Wrapper_UseX64=n

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100)

    Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0")
    Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50)

    Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1")
    Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50)

    Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2")
    Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

here is my current testing script:

;~ https://www.autoitscript.com/forum/topic/213665-how-can-i-detect-if-a-control-is-within-a-tab-control

#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_AU3Check=Y
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>
#include <WinAPISysWin.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180)
    ConsoleWrite("$hGUI_Main= " & $hGUI_Main & @CRLF)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100)
    Local $h_Tab_Main = ControlGetHandle($hGUI_Main, "", $id_Tab_Main)
    ConsoleWrite("$h_Tab_Main= " & $h_Tab_Main & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_Tab_Main) & @CRLF)

    Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0")
    Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50)
    Local $h_CheckBox_0 = ControlGetHandle($hGUI_Main, "", $id_CheckBox_0)
    ConsoleWrite("$h_CheckBox_0= " & $h_CheckBox_0 & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_CheckBox_0) & @CRLF)
    Local $hParent = _WinAPI_GetParent($h_CheckBox_0)
    ConsoleWrite("$hParent= " & WinGetHandle($hParent) & @CRLF)

    ConsoleWrite("$GA_PARENT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_PARENT) & @CRLF)
    ConsoleWrite("$GA_ROOT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOT) & @CRLF)
    ConsoleWrite("$GA_ROOTOWNER= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOTOWNER) & @CRLF)

    Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1")
    Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50)

    Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2")
    Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example


Func _GetTabControl($hWnd)
    While $hWnd <> 0
        Local $class = _WinAPI_GetClassName($hWnd)
        If $class = "SysTabControl32" Then Return $hWnd
        $hWnd = _WinAPI_GetParent($hWnd)
    WEnd
    Return 0
EndFunc   ;==>_GetTabControl

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

:unsure:

#AutoIt3Wrapper_UseX64=n

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>
#include <WinAPISysWin.au3>
#include <WinAPIGdi.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100)

    Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0")
    Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50)

    Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1")
    GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
    Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50)

    Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2")
    Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120)

    GUISetState(@SW_SHOW)

    ; Test cases
    ConsoleWrite("$id_CheckBox_0=" & _IsControlInTabRect($id_Tab_Main, $id_CheckBox_0) & " , " & @extended & @CRLF)
    ConsoleWrite("$id_CheckBox_1=" & _IsControlInTabRect($id_Tab_Main, $id_CheckBox_1) & " , " & @extended & @CRLF)
    ConsoleWrite("$id_CheckBox_2=" & _IsControlInTabRect($id_Tab_Main, $id_CheckBox_2) & " , " & @extended & @CRLF)
    ConsoleWrite("$id_CheckBox_Out=" & _IsControlInTabRect($id_Tab_Main, $id_CheckBox_Out) & " , " & @extended & @CRLF)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

Func _IsControlInTabRect($idTab, $idControl)
    ; Get the bounding rectangles of the Tab and the Control
    Local $tRectTab = _WinAPI_GetWindowRect(GUICtrlGetHandle($idTab))
    Local $tRectCtrl = _WinAPI_GetWindowRect(GUICtrlGetHandle($idControl))

    ; Get the intersection of the two rectangles
    Local $tIntersect = _WinAPI_IntersectRect($tRectTab, $tRectCtrl)

    ; Check if the intersection rectangle is NOT empty
    If DllStructGetData($tIntersect, "Left") <> 0 Or DllStructGetData($tIntersect, "Right") <> 0 Then
        ; If it intersects, return the current selected Tab Index (0, 1, etc.) in @extended
        Return SetError(0,  GUICtrlRead($idTab), True)
    EndIf

    Return SetError(0, 0, False) ; Not within the Tab area
EndFunc   ;==>_GetControlTabIndex

 

Edited by ioa747
corrected

I know that I know nothing

Posted

I also asked the AI, and it confirmed my suspicions.

TABS don't create any GUI; they manage the visibility of elements created within the definition of the entire TAB.

I think there are three possibilities:
1. Iterate through the tab by navigating to each TAB (clicking/activating) and checking which Controls become visible.
2. Store the ID of each control and know which control is in which TAB.
3. Create a separate CHILD GUI for each TAB and then create Controls on that CHILD GUI.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

example for 

Quote

2. Store the ID of each control and know which control is in which TAB.

;~ https://www.autoitscript.com/forum/topic/213665-how-can-i-detect-if-a-control-is-within-a-tab-control

#AutoIt3Wrapper_UseX64=n

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>
#include <WinAPISysWin.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180)
    ConsoleWrite("$hGUI_Main= " & $hGUI_Main & @CRLF)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100)
    Local $h_Tab_Main = ControlGetHandle($hGUI_Main, "", $id_Tab_Main)
    ConsoleWrite("$id_Tab_Main= " & $id_Tab_Main & @CRLF)
    ConsoleWrite("$h_Tab_Main= " & $h_Tab_Main & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_Tab_Main) & @CRLF)

    Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0")
    Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50)
    Local $h_CheckBox_0 = ControlGetHandle($hGUI_Main, "", $id_CheckBox_0)
    ConsoleWrite("$id_Tab_0= " & $id_Tab_0 & @CRLF)
    ConsoleWrite("$h_CheckBox_0= " & $h_CheckBox_0 & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_CheckBox_0) & @CRLF)
    Local $hParent = _WinAPI_GetParent($h_CheckBox_0)
    ConsoleWrite("$hParent= " & WinGetHandle($hParent) & @CRLF)

    ConsoleWrite("$GA_PARENT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_PARENT) & @CRLF)
    ConsoleWrite("$GA_ROOT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOT) & @CRLF)
    ConsoleWrite("$GA_ROOTOWNER= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOTOWNER) & @CRLF)

    Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1")
    Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50)
    ConsoleWrite("$id_Tab_1= " & $id_Tab_1 & @CRLF)
    ConsoleWrite("$id_CheckBox_1= " & $id_CheckBox_1 & @CRLF)

    Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2")
    Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50)
    ConsoleWrite("$id_Tab_2= " & $id_Tab_2 & @CRLF)
    ConsoleWrite("$id_CheckBox_2= " & $id_CheckBox_2 & @CRLF)

    Local $id_TAB_END = GUICtrlCreateTabItem("") ; end tabitem definition
    ConsoleWrite("! WARRNING FAKE ID :  $id_TAB_END= " & $id_TAB_END & @CRLF)
    Local $id_TAB_END_DUMMY = GUICtrlCreateDummy()
    ConsoleWrite("$id_TAB_END_DUMMY= " & $id_TAB_END_DUMMY & @CRLF)


    Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120)
    ConsoleWrite("$id_CheckBox_Out= " & $id_CheckBox_Out & @CRLF)

    Local $id_DUMMY_END = GUICtrlCreateDummy()
    For $IDX = 0 To $id_DUMMY_END
        ConsoleWrite($IDX & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($IDX)) & " >>> " & ControlGetText($hGUI_Main, "", $IDX) & @CRLF)
    Next

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then
            ExitLoop
        ElseIf $idMsg > $id_Tab_0 And $idMsg < $id_Tab_1 Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 0 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        ElseIf $idMsg > $id_Tab_1 And $idMsg < $id_Tab_2 Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 1 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        ElseIf $idMsg > $id_Tab_2 And $idMsg < $id_TAB_END_DUMMY Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 2 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        EndIf
    WEnd
EndFunc   ;==>Example


Func _GetTabControl($hWnd)
    While $hWnd <> 0
        Local $class = _WinAPI_GetClassName($hWnd)
        If $class = "SysTabControl32" Then Return $hWnd
        $hWnd = _WinAPI_GetParent($hWnd)
    WEnd
    Return 0
EndFunc   ;==>_GetTabControl

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Check also GUICtrlRead() In 'advanced' mode

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)
11 minutes ago, mLipok said:

example for 

Quote

2. Store the ID of each control and know which control is in which TAB.

just modified the example
just try to click each CheckBox and observe the console

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
2 hours ago, WildByDesign said:

I assume that you have to determine region or rect for the tab control and same for the other controls to determine if they overlap. Regions and rect measurements are still above my understanding. Or at least a bit fuzzy still.

This isn't a good approach. A given control located in the same area as a TAB may be obscured by it or may obscure the TAB by being outside of that TAB's structure.
Like in this following example
 

#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    GUICreate("My GUI Tab", 220, 110)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $idTab = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateCheckbox("Checkbox 1", 20, 50)
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateCheckbox("Checkbox 2", 0, 0, 220, 110)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

It seems that in C++, the programmer, as the application creator, determines by WM_NOTIFY that user is changing TAB from 0 to 1 and calls a function that hides or shows all controls inside TAB 0 or TAB 1.


In this case, it seems that AutoIt handles this internally. You'd have to ask @jpm or @Jon about that .
 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Another question is why  GUICtrlCreateTabItem("") does not immediately create a DUMMY control ID.

Local $id_TAB_END = GUICtrlCreateTabItem("") ; end tabitem definition
    ConsoleWrite("! WARRNING FAKE ID :  $id_TAB_END= " & $id_TAB_END & @CRLF)
    Local $id_TAB_END_DUMMY = GUICtrlCreateDummy()
    ConsoleWrite("$id_TAB_END_DUMMY= " & $id_TAB_END_DUMMY & @CRLF)

It seemed to me that I understood that this ID was being created, because the HelpFile documentation does not mention that it should happen otherwise.

what is your opinion?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

Here is my next example:

;~ https://www.autoitscript.com/forum/topic/213665-how-can-i-detect-if-a-control-is-within-a-tab-control

#AutoIt3Wrapper_UseX64=n

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPITheme.au3>
#include <WinAPISysWin.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGUI_Main = GUICreate("My GUI Tab", 220, 180)
    ConsoleWrite("$hGUI_Main= " & $hGUI_Main & @CRLF)

    GUISetBkColor(0x808080)
    GUISetFont(9, 300)

    Local $id_Tab_Main = GUICtrlCreateTab(10, 10, 200, 100)
    Local $h_Tab_Main = ControlGetHandle($hGUI_Main, "", $id_Tab_Main)
    ConsoleWrite("$id_Tab_Main= " & $id_Tab_Main & @CRLF)
    ConsoleWrite("$h_Tab_Main= " & $h_Tab_Main & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_Tab_Main) & @CRLF)

    Local $id_Tab_0 = GUICtrlCreateTabItem("Tab 0")
    Local $id_CheckBox_0 = GUICtrlCreateCheckbox("Checkbox 0", 20, 50)
    Local $h_CheckBox_0 = ControlGetHandle($hGUI_Main, "", $id_CheckBox_0)
    ConsoleWrite("$id_Tab_0= " & $id_Tab_0 & @CRLF)
    ConsoleWrite("$h_CheckBox_0= " & $h_CheckBox_0 & @CRLF)
    ConsoleWrite("WIN GET HANDL= " & WinGetHandle($h_CheckBox_0) & @CRLF)
    Local $hParent = _WinAPI_GetParent($h_CheckBox_0)
    ConsoleWrite("$hParent= " & WinGetHandle($hParent) & @CRLF)

    ConsoleWrite("$GA_PARENT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_PARENT) & @CRLF)
    ConsoleWrite("$GA_ROOT= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOT) & @CRLF)
    ConsoleWrite("$GA_ROOTOWNER= " & _WinAPI_GetAncestor($h_CheckBox_0, $GA_ROOTOWNER) & @CRLF)

    Local $id_Tab_1 = GUICtrlCreateTabItem("Tab 1")
    Local $id_CheckBox_1 = GUICtrlCreateCheckbox("Checkbox 1", 20, 50)
    ConsoleWrite("$id_Tab_1= " & $id_Tab_1 & @CRLF)
    ConsoleWrite("$id_CheckBox_1= " & $id_CheckBox_1 & @CRLF)

    Local $id_Tab_2 = GUICtrlCreateTabItem("Tab 2")
    Local $id_CheckBox_2 = GUICtrlCreateCheckbox("Checkbox 2", 20, 50)
    ConsoleWrite("$id_Tab_2= " & $id_Tab_2 & @CRLF)
    ConsoleWrite("$id_CheckBox_2= " & $id_CheckBox_2 & @CRLF)

    Local $id_TAB_END = GUICtrlCreateTabItem("") ; end tabitem definition
    ConsoleWrite("! WARRNING FAKE ID :  $id_TAB_END= " & $id_TAB_END & @CRLF)
    Local $id_TAB_END_DUMMY = GUICtrlCreateDummy()
    ConsoleWrite("$id_TAB_END_DUMMY= " & $id_TAB_END_DUMMY & @CRLF)


    Local $id_CheckBox_Out = GUICtrlCreateCheckbox("Checkbox outside the TAB area", 20, 120)
    ConsoleWrite("$id_CheckBox_Out= " & $id_CheckBox_Out & @CRLF)

    Local $id_DUMMY_END = GUICtrlCreateDummy()
    For $IDX = 0 To $id_DUMMY_END
        ConsoleWrite($IDX & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($IDX)) & " >>> " & ControlGetText($hGUI_Main, "", $IDX) & @CRLF)
    Next

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then
            ExitLoop
        ElseIf $idMsg > $id_Tab_0 And $idMsg < $id_Tab_1 Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 0 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        ElseIf $idMsg > $id_Tab_1 And $idMsg < $id_Tab_2 Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 1 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        ElseIf $idMsg > $id_Tab_2 And $idMsg < $id_TAB_END_DUMMY Then
            ConsoleWrite("Clicked control: " & $idMsg & " on TAB 2 >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($idMsg)) & " >>> " & ControlGetText($hGUI_Main, "", $idMsg) & @CRLF)
        EndIf
    WEnd

    #Region ; TAB DELETE TEST
    ConsoleWrite("DELETE TEST 0: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF)
    _GUICtrlTab_DeleteAllItems($id_Tab_Main)
    ConsoleWrite("DELETE TEST 1: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF)
    MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Check what happens with CheckBoxes after TabItems was Deleted')

    GUICtrlDelete($id_Tab_Main)
    #QUESTION How AutoIt knows that deleting TAB control also internal checkboxes should be deleted ?
    ConsoleWrite("! DELETE TEST 2: " & $id_CheckBox_1 & " >>> " & _WinAPI_GetClassName(GUICtrlGetHandle($id_CheckBox_1)) & " >>> " & ControlGetText($hGUI_Main, "", $id_CheckBox_1) & @CRLF)
    MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Check what happens with CheckBoxes after Tab control was Deleted')
    #EndRegion ; TAB DELETE TEST


EndFunc   ;==>Example


 

Take a look speciffically for      #Region ; TAB DELETE TEST

and 

Quote

#QUESTION How AutoIt knows that deleting TAB control also internal checkboxes should be deleted ?

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

These are all fascinating examples. Thank you. I can’t wait to dig in and try all of these. :)

Unfortunately I am stuck on a photoshoot job for most of the day with some predators (tigers 🐅) so likely come back bloody and sore in 4-6 hours. I need to land another one in NatGeo because last time was about a decade ago. Although the last NatGeo one was a puma. 

Anyway, I will get back on this later in the day. I appreciate it. This gives me lots of options.

Edited by WildByDesign
Posted (edited)
6 minutes ago, argumentum said:

why do you need to know 🤔

The ownerdraw tab control is eating part of the Static control brush when inside tab control. Particularly with Null brush. So if I can detect if inside tab control, I can do specific brush just for those controls in tab control. I think it did it with checkbox too but I can’t check at the moment.

This is related to changes that I am trying to make in GUIDarkTheme UDF regarding better handling of Static control colors specific to changing themes (dark to light, etc. but also material changes).

Mostly concept stage at the moment.

Edited by WildByDesign
Posted (edited)
8 minutes ago, WildByDesign said:

The ownerdraw tab control is eating part of the Static control brush when inside tab control

Also the reason why it happens is legit because it (tab control) needs to exclude the Rect of controls within it so that they don’t get painted over. It’s important for most controls. It’s just messing with my Static controls changes that I’m attempting.

Edited by WildByDesign

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...