Possible solution is catch the active tab-button and set the defaulted color as normal color for this button. After switch set back to normal.
Or disable the button if defaulted and color them. Enable if switch to another button.
Code: Select all
; GLOBAL SETTINGS ===============================================================================================================
#NoEnv
#SingleInstance Force
SetBatchLines -1
global version := 0.03
global IBAnimation := True ; enable / disable (hover-fade) animation
global IBNames := ["Startpage", "Menu 1", "Menu 2", "Menu 3", "Menu 4"]
global IBClrStyles := [ [0, 0x80FFFFFF, , 0xD3000000, 0, , 0x80FFFFFF, 1] ; normal
, [0, 0x80E6E6E6, , 0xD3000000, 0, , 0x80E6E6E6, 1] ; hover
, [0, 0x80CCCCCC, , 0xD3000000, 0, , 0x80CCCCCC, 1] ; pressed
, [0, 0x80F3F3F3, , 0x000078D7, 0, , 0x80F3F3F3, 1] ] ; disabled (defaulted)
; GUI ===========================================================================================================================
Gui, Margin, 0, 0
Gui, Color, FFFFFF
Gui, Font, s12, Segoe UI
Gui, Add, Button, xm ym w150 h30 0x100 hWndhBTN01 gMN_SELECT vMN_TAB_1, % " " IBNames[1]
ImageButton.Create(hBTN01, IBClrStyles*)
Gui, Add, Button, xm y+0 w150 h30 0x100 hWndhBTN02 gMN_SELECT vMN_TAB_2, % " " IBNames[2]
ImageButton.Create(hBTN02, IBClrStyles*)
Gui, Add, Button, xm y+0 w150 h30 0x100 hWndhBTN03 gMN_SELECT vMN_TAB_3, % " " IBNames[3]
ImageButton.Create(hBTN03, IBClrStyles*)
Gui, Add, Button, xm y+0 w150 h30 0x100 hWndhBTN04 gMN_SELECT vMN_TAB_4, % " " IBNames[4]
ImageButton.Create(hBTN04, IBClrStyles*)
Gui, Add, Button, xm y+0 w150 h30 0x100 hWndhBTN05 gMN_SELECT vMN_TAB_5, % " " IBNames[5]
ImageButton.Create(hBTN05, IBClrStyles*)
Gui, Add, Tab2, xm ym w0 h0 -Wrap Choose1 AltSubmit vMyMenuTab, % "1|2|3|4|5"
Gui, Tab, 1
Gui, Font, s14 c474747, Segoe UI
Gui, Add, Text, xm+150 ym w250 h250, % " " IBNames[1]
Gui, Tab, 2
Gui, Font, s14 c474747, Segoe UI
Gui, Add, Text, xm+150 ym w250 30, % " " IBNames[2]
Gui, Add, Button, xm+150 y+5 w80 h30, % "Test"
Gui, Tab, 3
Gui, Font, s14 c474747, Segoe UI
Gui, Add, Text, xm+150 ym w250 h250, % " " IBNames[3]
Gui, Tab, 4
Gui, Font, s14 c474747, Segoe UI
Gui, Add, Text, xm+150 ym w250 h250, % " " IBNames[4]
Gui, Tab, 5
Gui, Font, s14 c474747, Segoe UI
Gui, Add, Text, xm+150 ym w250 h250, % " " IBNames[5]
SystemParametersInfo(IBAnimation)
Gui, Show, AutoSize, % "AHK-Concept: Win10 Settings"
return
; SCRIPT ========================================================================================================================
MN_SELECT:
GuiControl, Choose, MyMenuTab, % k := SubStr(A_GuiControl, 8)
loop % IBNames.MaxIndex() {
if (k = A_Index)
GuiControl, Disable, MN_TAB_%A_Index%
else
GuiControl, Enable, MN_TAB_%A_Index%
}
return
; FUNCTIONS =====================================================================================================================
CtlColorBtns() ; https://github.com/jNizM/AHK_Scripts/blob/master/src/gui/GUI_CtlColorBtns.ahk
{
static init := OnMessage(0x0135, "CtlColorBtns")
return DllCall("gdi32\CreateSolidBrush", "uint", 0xFFFFFF, "uptr")
}
SystemParametersInfo(toggle := 0) ; https://msdn.microsoft.com/en-us/library/ms724947(v=vs.85).aspx
{
static SPI_SETCLIENTAREAANIMATION := 0x1043
if !(DllCall("user32\SystemParametersInfo", "uint", SPI_SETCLIENTAREAANIMATION, "uint", 0, "int", toggle, "uint", 0))
throw Exception("SystemParametersInfo failed: " A_LastError, -1)
return true
}
; INCLUDES ======================================================================================================================
#Include Class_ImageButton.ahk ; https://github.com/AHK-just-me/Class_ImageButton
; EXIT ==========================================================================================================================
GuiClose:
GuiEscape:
ExitApp
; ===============================================================================================================================