Jump to content

modern blog with modern checkboxes


Recommended Posts

I recently came across some excellent scripts by se7enstars. 

So I tried to combine them. Use his modern blog script with the modern (advanced version!!!!!) of the checkboxes script (source below)

 

I would like to have the modern checkboxes in one of the tabs (In the test and trial below I tried to place them in the team panel.  

I am trying to understand, but cant seem to get it working. 

 

 

 

#include<ModernCheckbox.au3>

#NoTrayIcon
Global $Assets = @ScriptDir & "\Assets\"
Global $uiWidth = 800, $uiHeight = 420
Global $btnCaption[5] = ["Get Started", "Information", "Teamwork", "About us", "Logout"]
Global $btnTop[5], $btnTopWidth = 102, $btnTopWidth = 32
Global $hFocus, $LastFocus, $hBkPic, $LastContent
Global $btnLearnMore, $AboutPanel
GLOBAL $check[6], $y = 50

$ui = GUICreate("Se7enstars Design", $uiWidth, $uiHeight, Default, Default, 0x80880000, 0x10000)
GUISetBkColor(0xFFFFFF, $ui)

_InitButton7s()

$Title_0 = GUICtrlCreateLabel("Se7enstars ", 10, 10, 100, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, 700, Default, "Segoe UI", 5)
$Title_1 = GUICtrlCreateLabel("UI", 110, 10, 80, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, Default, Default, "Segoe UI", 5)

For $i = 0 To 4
    $btnTop[$i] = _GUICtrlCreateButton7s($btnCaption[$i], ($uiWidth-112) - ($i*100), 10, 102, 32)
Next
_GUICtrlSetDefaultButton7s($btnTop[0], $ui)

GUISetState(@SW_SHOW)
_GetStartedPanel()

Do
    $msg = GUIGetMsg()
    For $i = 0 To 4
        If $msg = $btnTop[$i] Then
            _GUICtrlSetDefaultButton7s($btnTop[$i], $ui)
        EndIf
    Next

    For $checki = 0 To UBound($check)-1
                Switch $msg
            Case $check[$i]
                If _GUICtrlCheckBoxGetState($check[$checki]) = False Then
                    ConsoleWrite("vinkje uit" & @CRLF)
                    _GUICtrlCheckboxSetState($check[$checki], True)
                Else
                    ConsoleWrite("vinkje aan" & @CRLF)
                    _GUICtrlCheckboxSetState($check[$checki], False)
                EndIf
        EndSwitch
    Next

    Switch $msg
        Case $btnTop[0]
            GUIDelete($LastContent)
            _GetStartedPanel()
        Case $btnTop[1]
            GUIDelete($LastContent)
            _InfoPanel()
        Case $btnTop[2]
            GUIDelete($LastContent)
            _TeamPanel()
        Case $btnTop[3]
            GUIDelete($LastContent)
            _AboutPanel()
        Case $btnTop[4]
;~          $iExitMsg = MsgBox(4+32+256, "Info", "Do You want to exit ?", 0, $ui)
;~          If $iExitMsg = 6 Then
;~              GUICtrlSetData($Title_0, "Logging")
;~              GUICtrlSetColor($Title_0, 0xDD0000)
;~              GUICtrlSetData($Title_1, "out")
;~              GUICtrlSetColor($Title_1, 0xDD0000)
;~              Sleep(1500)
                Exit
;~          EndIf
        Case $btnLearnMore
            If $LastContent = $AboutPanel Then
                MsgBox(64, "Subscribe", "Please subscribe to our channel on Youtube")
;~              ShellExecute("https://youtube.com/c/se7enstars")
            EndIf
        Case $check[1]
            If $LastContent = $AboutPanel Then
;~         ;   case _GUICtrlCheckBoxGetState($check[1]) = True then
                If GuiCtrlRead($check[0]) = True then
            ConsoleWrite("ja, hij doet wat")
;~             If $LastContent = $AboutPanel Then
                      MsgBox(0,"test","test")
                EndIf
                endif
    EndSwitch

    $focusedCtrl = GUIGetCursorInfo()
    If Not @error Then
        Switch $focusedCtrl[4]
            Case $LastFocus
                If $hFocus <> $focusedCtrl[4] Then
                    _GUICtrlSetHover(1)
                    $hFocus = $focusedCtrl[4]
                EndIf
            Case Else
                If $hFocus <> Null Then
                    _GUICtrlSetHover(0)
                    $hFocus = Null
                EndIf
        EndSwitch
    EndIf
Until $msg = -3; Exit

Func _GetStartedPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $GetStartedPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)

    GUICtrlCreatePic($Assets & "bk1.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Database" & @CRLF & "Developers", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Wellcome to database control app" & @CRLF & "Please select what we need to do", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Learn More", 10, $GSP_H/2+80, 102, 32)
    _Animate($GetStartedPanel)
    GUISetState(@SW_SHOW, $GetStartedPanel)
    $LastContent = $GetStartedPanel
EndFunc

Func _InfoPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $InfoPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)

    GUICtrlCreatePic($Assets & "bk2.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("More" & @CRLF & "informations", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("We help you to get all off DB in secure" & @CRLF & "Need new account? Try create", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Sign Up", 10, $GSP_H/2+80, 102, 32)
    _Animate($InfoPanel)
    GUISetState(@SW_SHOW, $InfoPanel)
    $LastContent = $InfoPanel
EndFunc

Func _TeamPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $TeamPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)

    GUICtrlCreatePic($Assets & "bk3.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Teamwork" & @CRLF & "support", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Our project can work with team" & @CRLF & "Only get your token and connect", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Get Token", 10, $GSP_H/2+80, 102, 32)

For $i = 0 To 5
    $check[$i] = _GUICtrlCreateCheckboxEx(250, $y, 32, 32, $i)
    GUICtrlSetCursor(-1, 0)
    $y += 40 ;checkbox height
Next
    _Animate($TeamPanel)
    GUISetState(@SW_SHOW, $TeamPanel)
    $LastContent = $TeamPanel
EndFunc

Func _AboutPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $AboutPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)

    GUICtrlCreatePic($Assets & "bk4.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("About" & @CRLF & "this amazing app", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("This tool help you to craete edit " & @CRLF & "your cloud database! " & @CRLF & _
    "It was created from Se7enstars Developers Network © 2020", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Help && FAQ", 10, $GSP_H/2+80, 102, 32)
    _Animate($AboutPanel)
    GUISetState(@SW_SHOW, $AboutPanel)
    $LastContent = $AboutPanel
EndFunc

Func _Animate($hHWND, $iFadeIn = 1)
    If $iFadeIn = 1 Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00080000) ;fade-in
    Else
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00090000) ;fade-out
    EndIf
EndFunc

Func _InitButton7s()
    If $hBkPic = "" Then
        $hBkPic = GUICtrlCreatePic($Assets & "0.jpg", -99, -99, 102, 32)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)
    EndIf
    Return $hBkPic
EndFunc

Func _GUICtrlCreateButton7s($sText, $iX, $iY, $iW, $iH, $bColor = 0x000000)
    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
    GUICtrlSetColor(-1, $bColor)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
    GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlCreateButton7sEX($sText, $iX, $iY, $iW, $iH, $bColor = 0xFFFFFF)
        GUICtrlCreatePic($Assets & "0.jpg", $iX, $iY, $iW, $iH, 0x80)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)

    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
        GUICtrlSetColor(-1, $bColor)
        GUICtrlSetBkColor(-1, -2)
        GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
        GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlSetDefaultButton7s($hCtrlID, $hHWND = Default)
    Local $CGP = ControlGetPos($hHWND, '', $hCtrlID)
    GUICtrlSetPos(_InitButton7s(), $CGP[0], $CGP[1], $CGP[2], $CGP[3])
    GUICtrlSetColor($hCtrlID, 0xFFFFFF)
    If $LastFocus <> '' Then GUICtrlSetColor($LastFocus, 0x000000)
    $LastFocus = $hCtrlID
EndFunc

Func _GUICtrlSetHover($bHover = 0)
    If $bHover = 0 Then
        GUICtrlSetImage(_InitButton7s(), $Assets & "0.jpg")
    Else
        GUICtrlSetImage(_InitButton7s(), $Assets & "1.jpg")
    EndIf
EndFunc

 

source:

 

Edited by MightyWeird
Link to comment
Share on other sites

image.png.bfc4892eace2fb05a58cf4ef9bb83a62.png

1st add (how many checkboxes you want to create)

Global $check[6] 

2nd (used 250, $y, 32, 32, 6) >> 6 for that the gui bk is white, i used colored checkbox

$y = 50

    For $i = 0 To 5
        $check[$i] = _GUICtrlCreateCheckboxEx(250, $y, 32, 32, 6)
        GUICtrlSetCursor(-1, 0)
        $y += 40 ;checkbox height
    Next

3rd init to while >> switch >> case for clicking work

For $i = 0 To UBound($check)-1
        Switch $msg
            Case $check[$i]
                If _GUICtrlCheckBoxGetState($check[$i]) = False Then
                    _GUICtrlCheckboxSetState($check[$i], True)
                Else
                    _GUICtrlCheckboxSetState($check[$i], False)
                EndIf
        EndSwitch
    Next

FULL CODE!

#cs ----------------------------------------------------------------------------
 AutoIt Version: 3.3.14.5
 Author:         Se7enstars
 Youtube:        https://youtube.com/c/Se7enstars  | Subscribe please! :) & Like
#ce ----------------------------------------------------------------------------

;ReEdited for M W. (our youtube sibscriber) THANKS!

#include <ModernCheckbox.au3> ; MODERN CHECKBOX UDF

#NoTrayIcon
Global $Assets = @ScriptDir & "\Assets\"
Global $uiWidth = 800, $uiHeight = 420
Global $btnCaption[5] = ["Get Started", "Information", "Teamwork", "About us", "Logout"]
Global $btnTop[5], $btnTopWidth = 102, $btnTopWidth = 32
Global $hFocus, $LastFocus, $hBkPic, $LastContent
Global $btnLearnMore, $AboutPanel

Global $check[6]

$ui = GUICreate("Se7enstars Design", $uiWidth, $uiHeight, Default, Default, 0x80880000, 0x10000)
GUISetBkColor(0xFFFFFF, $ui)

_InitButton7s()

$Title_0 = GUICtrlCreateLabel("Se7enstars ", 10, 10, 100, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, 700, Default, "Segoe UI", 5)
$Title_1 = GUICtrlCreateLabel("UI", 110, 10, 80, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, Default, Default, "Segoe UI", 5)

For $i = 0 To 4
    $btnTop[$i] = _GUICtrlCreateButton7s($btnCaption[$i], ($uiWidth-112) - ($i*100), 10, 102, 32)
Next
_GUICtrlSetDefaultButton7s($btnTop[0], $ui)

GUISetState(@SW_SHOW)
_GetStartedPanel()

Do
    $msg = GUIGetMsg()
    For $i = 0 To 4
        If $msg = $btnTop[$i] Then
            _GUICtrlSetDefaultButton7s($btnTop[$i], $ui)
        EndIf
    Next

    For $i = 0 To UBound($check)-1
        Switch $msg
            Case $check[$i]
                If _GUICtrlCheckBoxGetState($check[$i]) = False Then
                    _GUICtrlCheckboxSetState($check[$i], True)
                Else
                    _GUICtrlCheckboxSetState($check[$i], False)
                EndIf
        EndSwitch
    Next

    Switch $msg
        Case $btnTop[0]
            GUIDelete($LastContent)
            _GetStartedPanel()
        Case $btnTop[1]
            GUIDelete($LastContent)
            _InfoPanel()
        Case $btnTop[2]
            GUIDelete($LastContent)
            _TeamPanel()
        Case $btnTop[3]
            GUIDelete($LastContent)
            _AboutPanel()
        Case $btnTop[4]
            $iExitMsg = MsgBox(4+32+256, "Info", "Do You want to exit ?", 0, $ui)
            If $iExitMsg = 6 Then
                GUICtrlSetData($Title_0, "Logging")
                GUICtrlSetColor($Title_0, 0xDD0000)
                GUICtrlSetData($Title_1, "out")
                GUICtrlSetColor($Title_1, 0xDD0000)
                Sleep(1500)
                Exit
            EndIf
        Case $btnLearnMore
            If $LastContent = $AboutPanel Then
                MsgBox(64, "Subscribe", "Please subscribe to our channel on Youtube")
                ShellExecute("https://youtube.com/c/se7enstars")
            EndIf
    EndSwitch

    $focusedCtrl = GUIGetCursorInfo()
    If Not @error Then
        Switch $focusedCtrl[4]
            Case $LastFocus
                If $hFocus <> $focusedCtrl[4] Then
                    _GUICtrlSetHover(1)
                    $hFocus = $focusedCtrl[4]
                EndIf
            Case Else
                If $hFocus <> Null Then
                    _GUICtrlSetHover(0)
                    $hFocus = Null
                EndIf
        EndSwitch
    EndIf
Until $msg = -3; Exit

Func _GetStartedPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $GetStartedPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk1.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Database" & @CRLF & "Developers", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Wellcome to database control app" & @CRLF & "Please select what we need to do", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Learn More", 10, $GSP_H/2+80, 102, 32)

    _Animate($GetStartedPanel)
    GUISetState(@SW_SHOW, $GetStartedPanel)
    $LastContent = $GetStartedPanel
EndFunc

Func _InfoPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $InfoPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk2.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("More" & @CRLF & "informations", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("We help you to get all off DB in secure" & @CRLF & "Need new account? Try create", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Sign Up", 10, $GSP_H/2+80, 102, 32)
    _Animate($InfoPanel)
    GUISetState(@SW_SHOW, $InfoPanel)
    $LastContent = $InfoPanel
EndFunc

Func _TeamPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $TeamPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk3.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Teamwork" & @CRLF & "support", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Our project can work with team" & @CRLF & "Only get your token and connect", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $y = 50

    For $i = 0 To 5
        $check[$i] = _GUICtrlCreateCheckboxEx(250, $y, 32, 32, 6)
        GUICtrlSetCursor(-1, 0)
        $y += 40 ;checkbox height
    Next

    $btnLearnMore = _GUICtrlCreateButton7sEx("Get Token", 10, $GSP_H/2+80, 102, 32)
    _Animate($TeamPanel)
    GUISetState(@SW_SHOW, $TeamPanel)
    $LastContent = $TeamPanel
EndFunc

Func _AboutPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $AboutPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk4.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("About" & @CRLF & "this amazing app", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("This tool help you to craete edit " & @CRLF & "your cloud database! " & @CRLF & _
    "It was created from Se7enstars Developers Network © 2020", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Help && FAQ", 10, $GSP_H/2+80, 102, 32)
    _Animate($AboutPanel)
    GUISetState(@SW_SHOW, $AboutPanel)
    $LastContent = $AboutPanel
EndFunc

Func _Animate($hHWND, $iFadeIn = 1)
    If $iFadeIn = 1 Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00080000) ;fade-in
    Else
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00090000) ;fade-out
    EndIf
EndFunc

Func _InitButton7s()
    If $hBkPic = "" Then
        $hBkPic = GUICtrlCreatePic($Assets & "0.jpg", -99, -99, 102, 32)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)
    EndIf
    Return $hBkPic
EndFunc

Func _GUICtrlCreateButton7s($sText, $iX, $iY, $iW, $iH, $bColor = 0x000000)
    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
    GUICtrlSetColor(-1, $bColor)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
    GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlCreateButton7sEX($sText, $iX, $iY, $iW, $iH, $bColor = 0xFFFFFF)
        GUICtrlCreatePic($Assets & "0.jpg", $iX, $iY, $iW, $iH, 0x80)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)

    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
        GUICtrlSetColor(-1, $bColor)
        GUICtrlSetBkColor(-1, -2)
        GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
        GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlSetDefaultButton7s($hCtrlID, $hHWND = Default)
    Local $CGP = ControlGetPos($hHWND, '', $hCtrlID)
    GUICtrlSetPos(_InitButton7s(), $CGP[0], $CGP[1], $CGP[2], $CGP[3])
    GUICtrlSetColor($hCtrlID, 0xFFFFFF)
    If $LastFocus <> '' Then GUICtrlSetColor($LastFocus, 0x000000)
    $LastFocus = $hCtrlID
EndFunc

Func _GUICtrlSetHover($bHover = 0)
    If $bHover = 0 Then
        GUICtrlSetImage(_InitButton7s(), $Assets & "0.jpg")
    Else
        GUICtrlSetImage(_InitButton7s(), $Assets & "1.jpg")
    EndIf
EndFunc

 

Recomended.png.6706221e0fb8a0eeee5f85479e779d7b.png All my tutorials >> Watch join.png.73002e34fb939ced80e2e5ae1b4c1d95.png

Link to comment
Share on other sites

  • 1 year later...

Can I still reply to old topic?

 

So after a while I decided to place a couple of new checkboxes on a new gui / panel, so checkboxes on multiple panels / guis.

But when I  switch from different panels / guis  the checkboxes dont work anymore .
I cant figure out why.

Somehow the checkboxes keep on counting ($i)  when I change gui / panel (see consolewrite)

I pm original author, but if someone can help me out...

 

 

#cs ----------------------------------------------------------------------------
 AutoIt Version: 3.3.14.5
 Author:         Se7enstars
 Youtube:        https://youtube.com/c/Se7enstars  | Subscribe please! :) & Like
#ce ----------------------------------------------------------------------------

;ReEdited for M W. (our youtube sibscriber) THANKS!

#include <ModernCheckbox.au3> ; MODERN CHECKBOX UDF

#NoTrayIcon
Global $Assets = @ScriptDir & "\Assets\"
Global $uiWidth = 800, $uiHeight = 420
Global $btnCaption[5] = ["Get Started", "Information", "Teamwork", "About us", "Logout"]
Global $btnTop[5], $btnTopWidth = 102, $btnTopWidth = 32
Global $hFocus, $LastFocus, $hBkPic, $LastContent
Global $btnLearnMore, $AboutPanel

Global $check[6]
Global $checktest[6]


$ui = GUICreate("Se7enstars Design", $uiWidth, $uiHeight, Default, Default, 0x80880000, 0x10000)
GUISetBkColor(0xFFFFFF, $ui)

_InitButton7s()

$Title_0 = GUICtrlCreateLabel("Se7enstars ", 10, 10, 100, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, 700, Default, "Segoe UI", 5)
$Title_1 = GUICtrlCreateLabel("UI", 110, 10, 80, 25, 0x0200, 0x00100000)
GUICtrlSetFont(-1, 14, Default, Default, "Segoe UI", 5)

For $i = 0 To 4
    $btnTop[$i] = _GUICtrlCreateButton7s($btnCaption[$i], ($uiWidth-112) - ($i*100), 10, 102, 32)
Next
_GUICtrlSetDefaultButton7s($btnTop[0], $ui)

GUISetState(@SW_SHOW)
_GetStartedPanel()

Do
    $msg = GUIGetMsg()
    For $i = 0 To 4
        If $msg = $btnTop[$i] Then
            _GUICtrlSetDefaultButton7s($btnTop[$i], $ui)
        EndIf
    Next

    For $i = 0 To UBound($check)-1
        Switch $msg
            Case $check[$i]
                ConsoleWrite("debug, check= " & $check[$i] & @CRLF)
                If _GUICtrlCheckBoxGetState($check[$i]) = False Then
                    _GUICtrlCheckboxSetState($check[$i], True)
                Else
                    _GUICtrlCheckboxSetState($check[$i], False)
                EndIf
        EndSwitch
    Next

        For $i = 0 To UBound($check)-1
        Switch $msg
            Case $checktest[$i]
                ConsoleWrite("debug, check= " & $checktest[$i] & @CRLF)
                If _GUICtrlCheckBoxGetState($checktest[$i]) = False Then
                    _GUICtrlCheckboxSetState($checktest[$i], True)
                Else
                    _GUICtrlCheckboxSetState($checktest[$i], False)
                EndIf
        EndSwitch
    Next

    Switch $msg
        Case $btnTop[0]
            GUIDelete($LastContent)
            _GetStartedPanel()
        Case $btnTop[1]
            GUIDelete($LastContent)
            _InfoPanel()
        Case $btnTop[2]
            GUIDelete($LastContent)
            _TeamPanel()
        Case $btnTop[3]
            GUIDelete($LastContent)
            _AboutPanel()
        Case $btnTop[4]
            $iExitMsg = MsgBox(4+32+256, "Info", "Do You want to exit ?", 0, $ui)
            If $iExitMsg = 6 Then
                GUICtrlSetData($Title_0, "Logging")
                GUICtrlSetColor($Title_0, 0xDD0000)
                GUICtrlSetData($Title_1, "out")
                GUICtrlSetColor($Title_1, 0xDD0000)
                Sleep(1500)
                Exit
            EndIf
        Case $btnLearnMore
            If $LastContent = $AboutPanel Then
                MsgBox(64, "Subscribe", "Please subscribe to our channel on Youtube")
                ShellExecute("https://youtube.com/c/se7enstars")
            EndIf
    EndSwitch

    $focusedCtrl = GUIGetCursorInfo()
    If Not @error Then
        Switch $focusedCtrl[4]
            Case $LastFocus
                If $hFocus <> $focusedCtrl[4] Then
                    _GUICtrlSetHover(1)
                    $hFocus = $focusedCtrl[4]
                EndIf
            Case Else
                If $hFocus <> Null Then
                    _GUICtrlSetHover(0)
                    $hFocus = Null
                EndIf
        EndSwitch
    EndIf
Until $msg = -3; Exit

Func _GetStartedPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $GetStartedPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk1.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Database" & @CRLF & "Developers", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Wellcome to database control app" & @CRLF & "Please select what we need to do", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Learn More", 10, $GSP_H/2+80, 102, 32)

    _Animate($GetStartedPanel)
    GUISetState(@SW_SHOW, $GetStartedPanel)
    $LastContent = $GetStartedPanel
EndFunc

Func _InfoPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $InfoPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk2.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("More" & @CRLF & "informations", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("We help you to get all off DB in secure" & @CRLF & "Need new account? Try create", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Sign Up", 10, $GSP_H/2+80, 102, 32)
    _Animate($InfoPanel)
    GUISetState(@SW_SHOW, $InfoPanel)
    $LastContent = $InfoPanel
EndFunc

Func _TeamPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $TeamPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk3.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("Teamwork" & @CRLF & "support", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

    Local $hLeftText = GUICtrlCreateLabel("Our project can work with team" & @CRLF & "Only get your token and connect", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $y = 50

    For $i = 0 To 5
        $check[$i] = _GUICtrlCreateCheckboxEx(250, $y, 32, 32, 6)
        GUICtrlSetCursor(-1, 0)
        $y += 40 ;checkbox height
    Next

    $btnLearnMore = _GUICtrlCreateButton7sEx("Get Token", 10, $GSP_H/2+80, 102, 32)
    _Animate($TeamPanel)
    GUISetState(@SW_SHOW, $TeamPanel)
    $LastContent = $TeamPanel
EndFunc

Func _AboutPanel()
    Local $GSP_W = $uiWidth
    Local $GSP_H = $uiHeight - 45
    $AboutPanel = GUICreate('', $uiWidth, $uiHeight - 45, 2, 45, 0x80000000, 0x00000040, $ui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreatePic($Assets & "bk4.jpg",$GSP_W-432, $GSP_H-324, 432, 324)
    GUICtrlSetState(-1, -128)

    Local $hLeftTitle = GUICtrlCreateLabel("About" & @CRLF & "this amazing app", 10, $GSP_H/2-100, 230, 80)
    GUICtrlSetFont(-1, 24, 700, Default, "Century Gothic", 5)

        $y = 50

        For $i = 0 To 5
        $checktest[$i] = _GUICtrlCreateCheckboxEx(250, $y, 32, 32, 6)
        GUICtrlSetCursor(-1, 0)
        $y += 40 ;checkbox height
        Next


    Local $hLeftText = GUICtrlCreateLabel("This tool help you to craete edit " & @CRLF & "your cloud database! " & @CRLF & _
    "It was created from Se7enstars Developers Network © 2020", 10, $GSP_H/2, 230, 80)
    GUICtrlSetFont(-1, 10, Default, Default, "Segoe UI", 5)

    $btnLearnMore = _GUICtrlCreateButton7sEx("Help && FAQ", 10, $GSP_H/2+80, 102, 32)
    _Animate($AboutPanel)
    GUISetState(@SW_SHOW, $AboutPanel)
    $LastContent = $AboutPanel
EndFunc

Func _Animate($hHWND, $iFadeIn = 1)
    If $iFadeIn = 1 Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00080000) ;fade-in
    Else
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hHWND, "int", 300, "long", 0x00090000) ;fade-out
    EndIf
EndFunc

Func _InitButton7s()
    If $hBkPic = "" Then
        $hBkPic = GUICtrlCreatePic($Assets & "0.jpg", -99, -99, 102, 32)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)
    EndIf
    Return $hBkPic
EndFunc

Func _GUICtrlCreateButton7s($sText, $iX, $iY, $iW, $iH, $bColor = 0x000000)
    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
    GUICtrlSetColor(-1, $bColor)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
    GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlCreateButton7sEX($sText, $iX, $iY, $iW, $iH, $bColor = 0xFFFFFF)
        GUICtrlCreatePic($Assets & "0.jpg", $iX, $iY, $iW, $iH, 0x80)
        GUICtrlSetState(-1, -128)
        GUICtrlSetCursor(-1, 0)

    Local $hCtrl = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, 0x01 + 0x0200)
        GUICtrlSetColor(-1, $bColor)
        GUICtrlSetBkColor(-1, -2)
        GUICtrlSetFont(-1, 10, Default, Default, "Century Gothic", 5)
        GUICtrlSetCursor(-1, 0)
    Return $hCtrl
EndFunc

Func _GUICtrlSetDefaultButton7s($hCtrlID, $hHWND = Default)
    Local $CGP = ControlGetPos($hHWND, '', $hCtrlID)
    GUICtrlSetPos(_InitButton7s(), $CGP[0], $CGP[1], $CGP[2], $CGP[3])
    GUICtrlSetColor($hCtrlID, 0xFFFFFF)
    If $LastFocus <> '' Then GUICtrlSetColor($LastFocus, 0x000000)
    $LastFocus = $hCtrlID
EndFunc

Func _GUICtrlSetHover($bHover = 0)
    If $bHover = 0 Then
        GUICtrlSetImage(_InitButton7s(), $Assets & "0.jpg")
    Else
        GUICtrlSetImage(_InitButton7s(), $Assets & "1.jpg")
    EndIf
EndFunc

 

Edited by MightyWeird
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...