Что нового

Нужна помощь с "вкладками".

DirtyJohny

Новичок
Сообщения
40
Репутация
0
Всем доброго вечера. Нужна помощь с окошками. Как можно сделать так, чтобы при клике например*Вкладка 2* окно сменялось на другое?Я понимаю,что надо создать,но пока не понимаю как...Не подсобите?)

Код:
#NoTrayIcon
Opt("GUIOnEventMode", 1)

Global $Assets = @ScriptDir & "\Assets\"
#Region Colors
Global $cUI_BK = 0x02101B
Global $cContent_BK = 0x091926
Global $cText = 0xDEDEDE
Global $cTextA = 0x56CBDD
Global $cCardBk = 0x0C1C29
#EndRegion Colors

#Region Position
Global $lastMenu = Default
Global $isOnTop = False
Global $ui_w = 800
Global $ui_h = 520
Global $topPanel_h = CalcPercent(12, $ui_h)
Global $bottomPanel_h = CalcPercent(8, $ui_h)
Global $bottomPanel_y = $ui_h - $bottomPanel_h
Global $leftPanel_w = CalcPercent(25, $ui_w)
Global $contentPanel_x = $leftPanel_w
Global $contentPanel_y = $topPanel_h
Global $contentPanel_w = $ui_w - $leftPanel_w
Global $contentPanel_h = $ui_h - ($topPanel_h + $bottomPanel_h)
#EndRegion Position

#EndRegion Position

Global $UI = GUICreate("Experience UI", $ui_w, $ui_h) ; $WS_POPUP, $WS_EX_CONTROLPARENT
WinSetTrans($UI, "", 0);
GUISetState(@SW_SHOW,$UI)
For $i = 0 To 233 Step 2
    WinSetTrans($UI, "", $i);Прозрачность 0-255

Next
#EndRegion ### END Koda GUI section ###
GUISetOnEvent(-3, "Terminate", $UI)
GUISetBkColor($cUI_BK, $UI)

Global $topPanel = GUICtrlCreateLabel("", 0, 0, $ui_w, $topPanel_h) ; height = 12% from UI | (ps. $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState($topPanel, 128) ; $GUI_DISABLE
GUICtrlSetBkColor($topPanel, $cUI_BK)

Global $bottomPanel = GUICtrlCreateLabel("", 0, $bottomPanel_y, $ui_w, $bottomPanel_h)
GUICtrlSetState($bottomPanel, 128) ; $GUI_DISABLE
GUICtrlSetBkColor($bottomPanel, $cUI_BK)

Global $leftPanel = GUICtrlCreateLabel("", 0, $topPanel_h, $leftPanel_w, $ui_h - ($topPanel_h + $bottomPanel_h))
GUICtrlSetState($leftPanel, 128) ; $GUI_DISABLE
GUICtrlSetBkColor($leftPanel, $cUI_BK)

Global $contentPanel = GUICtrlCreateLabel("", $contentPanel_x, $contentPanel_y, $contentPanel_w, $contentPanel_h)
GUICtrlSetState($contentPanel, 128) ; $GUI_DISABLE
GUICtrlSetBkColor($contentPanel, $cContent_BK)



Global $y = $topPanel_h
GUICtrlCreateLabel(" Программа", 52, $y, $leftPanel_w - 52, 32, 0x0200)
GUICtrlSetFont(-1, 12, 600, Default, "Segoe UI", 5) ; 5 = Clear Type
GUICtrlSetColor(-1, $cText)

$y += 50
Global $vDashboard = GUICtrlCreateLabel("Вкладка 1", 38, $y, $leftPanel_w - 38, 32, 0x0200)
GUICtrlSetOnEvent(-1, "DashboardEvent")
GUICtrlSetFont(-1, 11, 600, Default, "Segoe UI", 5) ; 5 = Clear Type
GUICtrlSetColor(-1, $cTextA)
GUICtrlSetCursor(-1, 0)
$lastMenu = $vDashboard
$y += 32
Global $vWallet = GUICtrlCreateLabel("Вкладка 2", 38, $y, $leftPanel_w - 38, 32, 0x0200)
GUICtrlSetOnEvent(-1, "WalletEvent")
GUICtrlSetFont(-1, 11, 600, Default, "Segoe UI", 5) ; 5 = Clear Type
GUICtrlSetColor(-1, $cText)
GUICtrlSetCursor(-1, 0)
$y += 32
Global $vMessages = GUICtrlCreateLabel("Вкладка 3", 38, $y, $leftPanel_w - 38, 32, 0x0200)
GUICtrlSetOnEvent(-1, "MessagesEvent")
GUICtrlSetFont(-1, 11, 600, Default, "Segoe UI", 5) ; 5 = Clear Type
GUICtrlSetColor(-1, $cText)
GUICtrlSetCursor(-1, 0)

$y = ($topPanel_h + 50)
Global $vIndicator = GUICtrlCreateLabel("", 0, $y, 4, 32)
GUICtrlSetBkColor(-1, $cTextA)


$x = $contentPanel_x + 10
$y = $contentPanel_y + 15
$Button1 = GUICtrlCreateButton("Кнопка 1", $x, $y, 267, 43)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma") ;задаем стиль элементу выше
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x545454)
GUISetState() ; Show GUI


GUISetState(@SW_SHOW, $UI)

While True
    Sleep(10)
WEnd

Func DashboardEvent()
    If $lastMenu <> $vDashboard Then
        Local $CGP = ControlGetPos($UI, '', $vDashboard)
        GUICtrlSetPos($vIndicator, 0, $CGP[1])
        GUICtrlSetColor($vDashboard, $cTextA)
        GUICtrlSetColor($lastMenu, $cText)
        $lastMenu = $vDashboard
    EndIf
EndFunc   ;==>DashboardEvent

Func WalletEvent()
    If $lastMenu <> $vWallet Then
        Local $CGP = ControlGetPos($UI, '', $vWallet)
        GUICtrlSetPos($vIndicator, 0, $CGP[1])
        GUICtrlSetColor($vWallet, $cTextA)
        GUICtrlSetColor($lastMenu, $cText)
        $lastMenu = $vWallet

    EndIf
EndFunc   ;==>WalletEvent

Func MessagesEvent()
    If $lastMenu <> $vMessages Then
        Local $CGP = ControlGetPos($UI, '', $vMessages)
        GUICtrlSetPos($vIndicator, 0, $CGP[1])
        GUICtrlSetColor($vMessages, $cTextA)
        GUICtrlSetColor($lastMenu, $cText)
        $lastMenu = $vMessages

    EndIf
EndFunc   ;==>MessagesEvent

Func Terminate()
    GUIDelete($UI)
    Exit
EndFunc   ;==>Terminate

Func Minimize()
    GUISetState(@SW_MINIMIZE, $UI)
EndFunc   ;==>Minimize


Func Topmost()
    If $isOnTop = False Then
        WinSetOnTop($UI, Default, 1)
        $isOnTop = True
    Else
        WinSetOnTop($UI, Default, 0)
        $isOnTop = False
    EndIf
EndFunc   ;==>Topmost

Func CalcPercent($vPercent, $vInt) ; Calculate percent % :)
    Return $vPercent * $vInt / 100
EndFunc   ;==>CalcPercent
 
Верх