Jump to content
Sign in to follow this  
iCode

Resize tabs relative to GUI width

Recommended Posts

iCode

A few quick searched yielded no results, so...
 
This sets the width of the tabs for a tab control according to the gui width. Additionally, it can control min/max gui size.
 
One benefit of this is, if you have a custom background color for your gui, you no longer have to do something 'sneaky' like adding a colored label to cover that unsightly gray area of the tab control.

This was updated to address the bug that @funkey found

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w 5
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")

Global $aTabCtrlPos, $aWinPos = WinGetPos($Form1)

; set initial tab width
_Tab_SetWidth(1) ; the parameter = the number of additional pixels to subtract from the tab width to avoid having the previous/next tab control show

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")
;GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; without the minimum gui size constraints (comment out above line)

While 1
    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE
            Exit

        Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
            _Tab_SetWidth(2)

    EndSwitch
WEnd

Func _Tab_SetWidth($i) ; sets the tab width

    Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
    ; size tabs - need to subtract a small number of pixels, else sometimes the previous/next tab control will show - the more tabs, the more we need to subtract
    ; the "2" in "/ 2" = the number of tabs in the tab control
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - $i)

EndFunc

Func WM_GETMINMAXINFO($hWnd, $MsgID, $wParam, $lParam)

    #forceref $MsgID, $wParam

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)

    DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; enforce a minimum width for the gui (min width will be the initial width of the gui)
    DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; enforce a minimum height for the gui (min height will be the initial height of the gui)
    _Tab_SetWidth(2)

    Return $GUI_RUNDEFMSG

EndFunc

; without the minimum gui size constraints (comment out WM_GETMINMAXINFO function)...
#cs
Func WM_SIZE($hWnd, $MsgID, $wParam, $lParam)

    #forceref $MsgID, $wParam, $lParam

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    _Tab_SetWidth(2)

    Return $GUI_RUNDEFMSG

EndFunc
#ce
Edited by iCode

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites
funkey

Works great, but not when maximizing and restoring the window.


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
iCode

Never tested that :)
 
Looks like i might need some help; WM_SIZE should work, but this is not working for me...

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")

Global $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional)

_Tab_SetWidth() ; set initial tab width

GUISetState(@SW_SHOW)

;GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG")
;GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WINMSG")
;GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG")
GUIRegisterMsg($WM_SIZE, "_WINMSG")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control

    Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

EndFunc

Func _WINMSG($hWnd, $MsgID, $wParam)

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    ;Switch $wParam
        ;Case 2
            ConsoleWrite("ok" & @LF)
            Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
            If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
    ;EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc

reference:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632646(v=vs.85).aspx

Edited by iCode

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites
iCode

This works, but i would like to see if anyone can do the same using only the Window Message instead of having the extra Case

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")

Global $aCtrlPosTab, $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional)

_Tab_SetWidth() ; set initial tab width

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG")
;GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WINMSG")
;GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG")
;GUIRegisterMsg($WM_SIZE, "_WINMSG")
;GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WINMSG")
;GUIRegisterMsg($WM_EXITSIZEMOVE, "_WINMSG")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
            $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
            If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

    EndSwitch
WEnd

Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control

    Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

EndFunc

Func _WINMSG($hWnd, $MsgID, $wParam, $lParam)

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)

    DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; min width
    DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; min height
    $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

    Return $GUI_RUNDEFMSG

EndFunc

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites
KaFu

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
 
Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")
 
Global $aCtrlPosTab, $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional)
 
_Tab_SetWidth() ; set initial tab width
 
GUISetState(@SW_SHOW)
 
GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG")
GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG")
;GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WINMSG")
;GUIRegisterMsg($WM_SIZE, "_WINMSG")
;GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WINMSG")
;GUIRegisterMsg($WM_EXITSIZEMOVE, "_WINMSG")
 
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
#cs
Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
$aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
#ce
 
EndSwitch
WEnd
 
Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control
 
Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
 
EndFunc   ;==>_Tab_SetWidth
 
Func _WINMSG($hWnd, $MsgID, $wParam, $lParam)
 
If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG
 
If $MsgID = $WM_SYSCOMMAND Then
Switch BitAND($wParam, 0xFFF0)
Case 0xF030, 0xF120 ; SC_MINIMIZE = 0xF020; SC_MAXIMIZE = 0xF030; SC_RESTORE = 0xF120
AdlibRegister("_Resize_Tab", 10)
EndSwitch
Return $GUI_RUNDEFMSG
EndIf
 
Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
 
DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; min width
DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; min height
$aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
 
Return $GUI_RUNDEFMSG
 
EndFunc   ;==>_WINMSG
 
Func _Resize_Tab()
Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
AdlibUnRegister("_Resize_Tab")
EndFunc   ;==>_Resize_Tab

Share this post


Link to post
Share on other sites
iCode

Hello KaFu

Am i correct in assessing that there is essentially no difference between using your AdLibRegister and my Case method? If so, personally i prefer using the extra Case.

Windows Messages are not a strong point for me, so if i may ask, where does the '0xFFF0' come from in: Switch BitAND($wParam, 0xFFF0)?

Edit: i shortened the code and updated the first post

Edited by iCode

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites
KaFu

Am i correct in assessing that there is essentially no difference between using your AdLibRegister and my Case method? If so, personally i prefer using the extra Case.

 

Not quite. The WM message and also the Adlib is fired even if the working loop is currently occupied.

 

Windows Messages are not a strong point for me, so if i may ask, where does the '0xFFF0' come from in: Switch BitAND($wParam, 0xFFF0)?

 

From the MSDN documentation for WM_SYSCOMMAND :)...

"In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by the system. To obtain the correct result when testing the value of wParam, an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator."

Share this post


Link to post
Share on other sites
iCode

1) I was only interested in resizing if the max/restore control was pressed (and of course if the resize was done by dragging the window frame)

2) Oh, i see! I was looking at the wrong doc :)

Thanks!


FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Share this post


Link to post
Share on other sites
mLipok

In one of my projects I have a problem that I see is also found here.

HOWTO:
Open Kafu modified script in SciTE4AutoIt

Run it using F5 key.

When window Appear use following key combination in this order:
WIN + UP
WIN + DOWN
WIN + LEFT
WIN + RIGHT
WIN + RIGHT

Now you can see that, tab do not resize automaticaly.

Do you have any idea how to make change Tab size in this case?

 

EDIT:

I have this issue in my Acrobat Reader - ActiveX Viewer

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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
 

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 *

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 * 

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 TaskScheduler

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 *

"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: 2018-10-15

Share this post


Link to post
Share on other sites
KaFu

Good point, this version works for me under the stated conditions.

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")

Global $aCtrlPosTab, $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional)

_Tab_SetWidth() ; set initial tab width

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG")
GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control

    Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

EndFunc   ;==>_Tab_SetWidth

Func _WINMSG($hWnd, $MsgID, $wParam, $lParam)

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    Switch $MsgID
        Case $WM_SYSCOMMAND
            Switch BitAND($wParam, 0xFFF0)
                Case 0xF030, 0xF120 ; SC_MINIMIZE = 0xF020; SC_MAXIMIZE = 0xF030; SC_RESTORE = 0xF120
                    AdlibRegister("_Resize_Tab", 10)
            EndSwitch
        Case $WM_GETMINMAXINFO
            #cs
                Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
                DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; min width
                DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; min height
                $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
                If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
            #ce
            AdlibRegister("_Resize_Tab", 10)
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WINMSG

Func _Resize_Tab()
    Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
    If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
    AdlibUnRegister("_Resize_Tab")
EndFunc   ;==>_Resize_Tab

Share this post


Link to post
Share on other sites
mLipok

Awesome.

Thanks @KaFu

mLipok

ps.

for other intresting tab stuff look here


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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
 

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 *

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 * 

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 TaskScheduler

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 *

"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: 2018-10-15

Share this post


Link to post
Share on other sites
guinness

A little more verstaile from KaFu's example. Now it gets the tab count.

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>


Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required!
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlCreateTabItem("TabSheet1")
GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("TabSheet3")
GUICtrlCreateTabItem("TabSheet4")
GUICtrlCreateTabItem("TabSheet5")
GUICtrlCreateTabItem("TabSheet6")
GUICtrlCreateTabItem("")

Global $aCtrlPosTab, $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional)

_Tab_SetWidth() ; set initial tab width

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG")
GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control

    Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; used to set tab width
    If Not @error Then _GUICtrlTab_SetItemSize($Tab1, Int($aCtrlPosTab[2] / _GUICtrlTab_GetItemCount($Tab1)) - 2, 0); size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show

EndFunc   ;==>_Tab_SetWidth

Func _WINMSG($hWnd, $MsgID, $wParam, $lParam)

    If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG

    Switch $MsgID
        Case $WM_SYSCOMMAND
            Switch BitAND($wParam, 0xFFF0)
                Case 0xF030, 0xF120 ; SC_MINIMIZE = 0xF020; SC_MAXIMIZE = 0xF030; SC_RESTORE = 0xF120
                    AdlibRegister("_Resize_Tab", 10)
            EndSwitch
        Case $WM_GETMINMAXINFO
            #cs
                Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
                DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; min width
                DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; min height
                $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
                If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
            #ce
            AdlibRegister("_Resize_Tab", 10)
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WINMSG

Func _Resize_Tab()
    Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size
    If Not @error Then _GUICtrlTab_SetItemSize($Tab1, Int($aCtrlPosTab[2] / _GUICtrlTab_GetItemCount($Tab1)) - 2, 0); size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show
    AdlibUnRegister("_Resize_Tab")
EndFunc   ;==>_Resize_Tab

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

Without Global variables (which isn't my style.) I also added $SC_RESTORE, which isn't present in KaFu's example.

#include <GUIConstants.au3>
#include <GuiTab.au3>
#include <MenuConstants.au3>
#include <WindowsConstants.au3>

Global Enum $CONTROLGETPOS_XPOS, $CONTROLGETPOS_YPOS, $CONTROLGETPOS_WIDTH, $CONTROLGETPOS_HEIGHT

Example()

Func Example()
    Local $hGUI = GUICreate('', 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
    Local $iTab = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH is required.
    GUICtrlSetResizing($iTab, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)

    GUICtrlCreateTabItem('TabSheet 1')
    GUICtrlCreateTabItem('TabSheet 2')
    GUICtrlCreateTabItem('')

    ; Assign the handle and tab control.
    _Tab_SetWidth($hGUI, $iTab)

    GUIRegisterMsg($WM_GETMINMAXINFO, _Event_Proc)
    GUIRegisterMsg($WM_SYSCOMMAND, _Event_Proc)

    GUISetState(@SW_SHOW, $hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

Func _Event_Proc($hWnd, $iMsg, $wParam, $lParam)
    If IsHWnd($hWnd) Then
        Switch $iMsg
            Case $WM_SYSCOMMAND
                Switch _WinAPI_LoWord($wParam)
                    Case $SC_MINIMIZE, $SC_MAXIMIZE, $SC_RESTORE, $SC_SIZE
                        AdlibRegister(_Tab_ResizeWidth, 10)

                EndSwitch

            Case $WM_GETMINMAXINFO
                AdlibRegister(_Tab_ResizeWidth, 10)

        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_Event_Proc

Func _Tab_ResizeWidth()
    Return __Tab_SetWidth(Default, Default)
EndFunc   ;==>_Tab_ResizeWidth

Func _Tab_SetWidth($hWnd, $iTab)
    Return __Tab_SetWidth($hWnd, $iTab)
EndFunc   ;==>_Tab_SetWidth

Func __Tab_SetWidth($hWnd = Default, $iTab = Default)
    Local Static $hWnd_Static = 0, $iTab_Static = -9999
    If IsHWnd($hWnd) And IsInt($iTab) And $iTab > 0 Then
        $hWnd_Static = $hWnd
        $iTab_Static = $iTab
    ElseIf IsKeyword($hWnd) And IsKeyword($iTab) Then
        Local $aCtrlPosTab = ControlGetPos($hWnd_Static, '', $iTab_Static)
        If Not @error Then
            Local $iWidth = Floor($aCtrlPosTab[$CONTROLGETPOS_WIDTH] / _GUICtrlTab_GetItemCount($iTab_Static)) - 2 ; Deduct 2px for the left/right arrows.
            _GUICtrlTab_SetItemSize($iTab_Static, $iWidth, 0)
        EndIf
        AdlibUnRegister(_Tab_ResizeWidth)
    EndIf
    Return True
EndFunc   ;==>__Tab_SetWidth
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
mLipok

very nice guinness


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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
 

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 *

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 * 

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 TaskScheduler

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 *

"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: 2018-10-15

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hi dears
      I've got a question in creating tabs in autoit
      Usually in other programs you can move between tabs by pressing ctrl + tab or ctrl + shift + tab
      I tried to create a window  which have a multy  tab but when i press one of the shortcuts
      it does not move between the tabs
      Is there an option to enable or disable this
      Greetings
      this is the example i tryed

      #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <TabConstants.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> effectsSettings() func effectsSettings() local $echoCombo[6], $reverbCombo[5],  $CHORUSCombo[8], $flangerCombo[8], $paramEQCombo[4], $distortionCombo[6], $gargleCombo[3] $EffWindow = GUICreate("efects settings", 400, 400, -1, -1, $WS_TABSTOP) local $BtOK = GUICtrlCreateButton("ok", 5, 360, 50, 30, 0x01) GUIStartGroup("") local $BTCancel = GUICtrlCreateButton("cancel", 340, 360, 50, 30) GUIStartGroup("") local $effectTabs =     GUICtrlCreateTab(10, 10, 380, 70) GUICtrlSetState(-1, $GUI_focus)     GUICtrlCreateTabItem("echo") GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60) $echoCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fFeedback", 180, 100, 100, 60) $echoCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fLeftDelay", 290, 100, 100, 60) $echoCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40) GUICtrlCreateLabel("fRightDelay", 50, 180, 100, 60) $echoCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40) GUICtrlCreateLabel("lPanDelay", 180, 180, 100, 60) $echoCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)     GUICtrlCreateTabItem("reverb") GUICtrlCreateLabel("fInGain", 50, 100, 100, 60) $ReverbCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fReverbMix", 180, 100, 100, 60) $ReverbCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fReverbTime", 290, 100, 100, 60) $ReverbCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40) GUICtrlCreateLabel("fHighFreqRTRatio", 50, 180, 100, 60) $ReverbCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)     GUICtrlCreateTabItem("chorus") GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60) $ChorusCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fDepth", 180, 100, 100, 60) $ChorusCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60) $ChorusCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40) GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60) $ChorusCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40) GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60) $ChorusCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40) GUICtrlCreateLabel("fDelay", 290, 180, 100, 60) $ChorusCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40) GUICtrlCreateLabel("lPhase", 50, 260, 100, 60) $ChorusCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)     GUICtrlCreateTabItem("flanger") GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60) $FlangerCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fDepth", 180, 100, 100, 60) $FlangerCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60) $FlangerCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40) GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60) $FlangerCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40) GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60) $FlangerCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40) GUICtrlCreateLabel("fDelay", 290, 180, 100, 60) $FlangerCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40) GUICtrlCreateLabel("lPhase", 50, 260, 100, 60) $FlangerCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)     GUICtrlCreateTabItem("paramatric eq") GUICtrlCreateLabel("fCenter", 50, 100, 100, 60) $parameqCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fBandwidth", 180, 100, 100, 60) $ParamEqCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fGain", 290, 100, 100, 60) $parameqCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)     GUICtrlCreateTabItem("distortion") GUICtrlCreateLabel("fGain", 50, 100, 100, 60) $distortionCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("fEdge", 180, 100, 100, 60) $distortionCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUICtrlCreateLabel("fPostEQCenterFrequency", 290, 100, 100, 60) $distortionCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40) GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60) $distortionCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40) GUICtrlCreateLabel("fPostEQBandwidth", 180, 180, 100, 60) $distortionCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)     GUICtrlCreateTabItem("gargle") GUICtrlCreateLabel("dwRateHz", 50, 100, 100, 60) $gargleCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40) GUICtrlCreateLabel("dwWaveShape", 180, 100, 100, 60) $gargleCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40) GUISetState(@sw_show, $EffWindow) While 1 Switch GUIGetMSG() case $GUI_Event_close, $BTCancel exit EndSwitch Wend return "" endFunc
    • nassausky
      By nassausky
      Hi all,
       
      Anyone have any idea how to close all open tabs except a specific one I manually open.  Assuming I don't know what is open in all the tabs except just the one I want to keep open.
       
      I didn't want to use sendkeys and I was trying to use the following code to list the title (or url) of the 3 open tabs and  after I got that part working I would just close the other 2. This sample only displays the title of the first open tab
      #include <IE.au3> Const $ie_new_in_tab = 0x0800 $oIE = _IECreate("https://www.autoitscript.com") __IENavigate($oIE, "https://www.autoitscript.com/forum/", 1, $ie_new_in_tab) ;(obj,url,wait,param) __IENavigate($oIE, "https://www.google.com/", 1, $ie_new_in_tab) ;(obj,url,wait,param) Local $aIE[1] $aIE[0] = 0 Local $i = 1, $oIE While 1     $oIE = _IEAttach("", "instance", $i)     If @error = $_IEStatus_NoMatch Then ExitLoop     ConsoleWrite(_IEPropertyGet($oIE, "title") & @CRLF)     ReDim $aIE[$i + 1]     $aIE[$i] = $oIE ;each item holds object     $aIE[0] = $i ;first item holds count     $i += 1 WEnd MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0]) ; This doesn't return the list of tabs in the console just the first tab  
      Thanks for any and all help
    • Miliardsto
      By Miliardsto
      Hello I got these tabs
       
      Global $TabMain = GUICtrlCreateTabItem("Main") Global $Action = GUICtrlCreateTabItem("Actions") Global $TabThings = GUICtrlCreateTabItem("Things") As we know to change tab we have to click with mouse on tab name like here it looks like below.
      Is there possibility to change tab without click on the tab but change by click on button for example?

    • kawliga751
      By kawliga751
      I am trying to script the opening of multiple tabs in IE with each tab having a separate login/password. I have been able to make a successful script that will open 3 separate IE sessions with the correct webpage and login or a script that will open 3 tabs in one session (which I want) but will not login. I have tried _IECreate, IEAttach etc. This is the script I am currently using . 
      #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/AAAA/index.htm') ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) Call ("YYYYYYYSignIn") Func YYYYYYYSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/xxxxxxx/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc Call ("xxxxxxxSignIn") Func xxxxxxxSignIn () __IENavigate($oIE, "https://soa1gui.xxxxxxx.biz/gateway/NFServlet;jsessionid=1E3B8F6520DE0A1EC914A8ABB7E86341?NFH_MessageId=&NFH_Page=%2fpages%2fsearch%2fsearch.jsp", 1, 0x800) Local $domain = _IEGetObjByName ($oIE,"NF_CustomerID") Local $User_Name = _IEGetObjByName ($oIE,"NF_UserName") Local $Password = _IEGetObjByName ($oIE,"NF_Password") _IEFormElementSetValue ($domain, xxxxxxx") _IEFormElementSetValue ($User_Name, "xxxxxxx") _IEFormElementSetValue ($Password, "xxxxxxx") ;Send('{Enter}') EndFunc  
    • Skeletor
      By Skeletor
      Hi Guys,
      I've been reading this post ...
      When I came accross the examples, non of them had what I was looking for.
      I basically want to "snapshot" my GUI's multiple tabs and send them into the pdf.
      A little nudge from you guys would be great.
      Im really stuck with this one, therefore I have no code.
      Lets discuss or point me in a right direction... thanks alot
       

×