#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$iGUI_Width = 300
$iGUI_Height = 200
$iSttngs_Bttn_Width = 18
$iSttngs_Bttn_Height = Floor($iGUI_Height / 2.5)
$iSttngs_Bttn_Top = ($iGUI_Height / 2) - ($iSttngs_Bttn_Height / 2) - 20
$hMain_GUI = GUICreate('Sliding Settings Demo!', $iGUI_Width, $iGUI_Height)
GUISetState(@SW_SHOW, $hMain_GUI)
;Settings GUI
$hSttngs_GUI = GUICreate('Settings', $iGUI_Width - 40, $iGUI_Height - 30, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $hMain_GUI)
$iSttngs_Bttn = GUICtrlCreateButton('…', -2, $iSttngs_Bttn_Top, $iSttngs_Bttn_Width, $iSttngs_Bttn_Height)
GUICtrlSetFont(-1, 8.3, 0, 0, 'Wingdings 3')
GUICtrlSetTip(-1, 'Expand Settings')
$iSttngs_First_ID = GUICtrlCreateDummy() + 1
GUICtrlCreateCheckbox('Option 1', 70, 20)
GUICtrlCreateCheckbox('Option 2', 70, 40)
GUICtrlCreateCheckbox('Option 3', 70, 60)
GUICtrlCreateInput('Input', 70, 90)
$iSave_Bttn = GUICtrlCreateButton('Save', 20, $iGUI_Height - 60, 70, 20)
GUICtrlSetState(-1, $GUI_HIDE)
$iSttngs_Last_ID = GUICtrlCreateDummy() - 1
_SttngsCtrls_Set_State($GUI_HIDE)
$aGUI_Pos = WinGetPos($hMain_GUI)
WinMove($hSttngs_GUI, '', $aGUI_Pos[0] + $iGUI_Width - 15, $aGUI_Pos[1] + 40, $iSttngs_Bttn_Width)
GUISetState(@SW_SHOW, $hSttngs_GUI)
WinActivate($hMain_GUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $iSave_Bttn
;Apply setting here
GUISetState(@SW_DISABLE, $hMain_GUI)
MsgBox(64, 'Info', 'Settings saved!', 0, $hSttngs_GUI)
GUISetState(@SW_ENABLE, $hMain_GUI)
ContinueCase
Case $iSttngs_Bttn
$aGUI_Pos = WinGetPos($hMain_GUI)
;Hide
If GUICtrlRead($iSttngs_Bttn) = '†' Then
For $i = ($iGUI_Width - 30) To 1 Step -30
WinMove($hSttngs_GUI, '', $aGUI_Pos[0] + $iGUI_Width - $i, $aGUI_Pos[1] + 40, $i+4)
Sleep(15)
Next
GUISetStyle($WS_POPUP, -1, $hSttngs_GUI)
WinMove($hSttngs_GUI, '', $aGUI_Pos[0] + $iGUI_Width - 15, $aGUI_Pos[1] + 40, $iSttngs_Bttn_Width)
GUICtrlSetData($iSttngs_Bttn, '…')
GUICtrlSetTip($iSttngs_Bttn, 'Expand Settings')
_SttngsCtrls_Set_State($GUI_HIDE)
;Show
Else
_SttngsCtrls_Set_State($GUI_SHOW)
GUISetStyle($WS_POPUPWINDOW, -1, $hSttngs_GUI)
For $i = 1 To ($iGUI_Width - 30) Step 30
WinMove($hSttngs_GUI, '', $aGUI_Pos[0] + $iGUI_Width - $i, $aGUI_Pos[1] + 40, $i+4)
Sleep(15)
Next
WinMove($hSttngs_GUI, '', $aGUI_Pos[0] + 30, $aGUI_Pos[1] + 40, $iGUI_Width - 26)
GUICtrlSetData($iSttngs_Bttn, '†')
GUICtrlSetTip($iSttngs_Bttn, 'Collapse Settings')
EndIf
WinActivate($hMain_GUI)
EndSwitch
WEnd
Func _SttngsCtrls_Set_State($iState)
For $iID = $iSttngs_First_ID To $iSttngs_Last_ID
GUICtrlSetState($iID, $iState)
Next
EndFunc