Guibutton

  • Hallo, Weiß jemand wie ich am besten ein Button registrieren lasse
    und sie wieder destroye?

    Bei mir taucht nähmlich ein fehler auf:


    Spoiler anzeigen
    [autoit]


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

    [/autoit] [autoit][/autoit] [autoit]

    local $timenews = ""
    Switch @Hour
    case 0 to 5
    $timenews = "Eine Wunderschöne Nacht"
    case 6 to 11
    $timenews = "Guten Morgen :)"
    Case 11 to 14
    $timenews = "Mittags ist immer schön"
    Case 15 to 17
    $timenews = "Nachmittags die perfekte zeit"
    Case 18 to 21
    $timenews = "Eine schönen Abend gewünscht :)"
    Case Else
    $timenews = "Nacht zocker du :D"
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    func butt()
    $g1setup = GUICtrlCreateButton("Setup", 205, 384, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    func butt2()
    $g2setup = GUICtrlCreateButton("Setup", 245, 384, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    $tst = GUICreate("test", 655, 585, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_TABSTOP))
    GUISetBkColor(0x000000)

    [/autoit] [autoit][/autoit] [autoit]

    $exit = GUICtrlCreateButton("X", 624, 0, 27, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $profile = GUICtrlCreateButton("Profile", 8, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $seeting = GUICtrlCreateButton("Settings", 88, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $client = GUICtrlCreateButton("Client", 168, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $l1 = GUICtrlCreateLabel($timenews, 256, 8, 330, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFF0000)

    [/autoit] [autoit][/autoit] [autoit]

    $info = GUICtrlCreateEdit("", 208, 413, 433, 161)
    GUICtrlSetData($info,"Willkommen bei Test")

    [/autoit] [autoit][/autoit] [autoit]

    $Tab1 = GUICtrlCreateTab(8, 64, 193, 510)
    GUICtrlCreateTabItem("")

    [/autoit] [autoit][/autoit] [autoit]

    $tw = GUICtrlCreateTreeView(16, 80, 177, 490)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFF0000)

    [/autoit] [autoit][/autoit] [autoit]

    $games = GUICtrlCreateTreeViewItem("Spiele",$tw)
    $g1 = GUICtrlCreateTreeViewItem("The Game",$games)
    $setup = GUICtrlCreateTreeViewItem("Setup",$g1)

    [/autoit] [autoit][/autoit] [autoit]

    $programme = GUICtrlCreateTreeViewItem("Programme",$tw)
    $p1 = GUICtrlCreateTreeViewItem("Radio",$programme)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $exit
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $g1
    butt()
    _GUICtrlButton_Destroy($setup)
    $infog1 = FileRead(@tempdir & "\zz\Launcher\info\g1.txt")
    GUICtrlSetData($info,$infog1)

    [/autoit] [autoit][/autoit] [autoit]

    Case $p1
    butt2()
    _GUICtrlButton_Destroy($setup)
    $infop1 = FileRead(@tempdir & "\zz\Launcher\info\p1.txt")
    GUICtrlSetData($info,$infop1)

    [/autoit] [autoit][/autoit] [autoit]

    Case $g1setup
    MsgBox(0,"test","ey")

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    wäre nett wenn jemand mein fehler finden würde :D

    :):):):)

    Eine Antwort :D

  • Du hast $g1setup nicht global deklariert. Hab dir das kurz gemacht, aber müsstest noch einiges verbessern :) Viel Glück

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <TabConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    $g1setup = 0
    local $timenews = ""
    Switch @Hour
    case 0 to 5
    $timenews = "Eine Wunderschöne Nacht"
    case 6 to 11
    $timenews = "Guten Morgen :)"
    Case 11 to 14
    $timenews = "Mittags ist immer schön"
    Case 15 to 17
    $timenews = "Nachmittags die perfekte zeit"
    Case 18 to 21
    $timenews = "Eine schönen Abend gewünscht :)"
    Case Else
    $timenews = "Nacht zocker du :D"
    EndSwitch
    func butt()
    $g1setup = GUICtrlCreateButton("Setup", 205, 384, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    EndFunc
    func butt2()
    $g2setup = GUICtrlCreateButton("Setup", 245, 384, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    EndFunc
    $main_gui = GUICreate("test", 655, 585, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_TABSTOP))
    GUISetBkColor(0x000000)
    $exit = GUICtrlCreateButton("X", 624, 0, 27, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $profile = GUICtrlCreateButton("Profile", 8, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $settings = GUICtrlCreateButton("Settings", 88, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $client = GUICtrlCreateButton("Client", 168, 8, 75, 25)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1,0x000000)
    $l1 = GUICtrlCreateLabel($timenews, 256, 8, 330, 25)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFF0000)
    $info = GUICtrlCreateEdit("", 208, 413, 433, 161)
    GUICtrlSetData($info,"Willkommen bei Test")
    $Tab1 = GUICtrlCreateTab(8, 64, 193, 510)
    GUICtrlCreateTabItem("")
    $tw = GUICtrlCreateTreeView(16, 80, 177, 490)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFF0000)
    $games = GUICtrlCreateTreeViewItem("Spiele",$tw)
    $g1 = GUICtrlCreateTreeViewItem("The Game",$games)
    $setup = GUICtrlCreateTreeViewItem("Setup",$g1)
    $programme = GUICtrlCreateTreeViewItem("Programme",$tw)
    $p1 = GUICtrlCreateTreeViewItem("Radio",$programme)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $exit
    Exit
    Case $g1
    butt()
    _GUICtrlButton_Destroy($setup)
    $infog1 = FileRead(@tempdir & "\zz\Launcher\info\g1.txt")
    GUICtrlSetData($info,$infog1)
    Case $p1
    butt2()
    _GUICtrlButton_Destroy($setup)
    $infop1 = FileRead(@tempdir & "\zz\Launcher\info\p1.txt")
    GUICtrlSetData($info,$infop1)
    Case $g1setup
    MsgBox(0,"test","ey")
    EndSwitch
    WEnd

    [/autoit]
  • Denn wert $g1setup habe ich auf eins gelegt.

    Das Problem ist jetzt, das ich die erstellen button nicht wieder destroyen kann.

    Kennt sich jemand mit Guibutton.au3 aus?

    Oder besser gefragt, kann man eine Func wieder beenden?

    Edit:

    Naja noch einfach ging es garnicht :D

    [autoit]


    GUICtrlDelete($setup)

    [/autoit]

    :):):):)

    Eine Antwort :D

    3 Mal editiert, zuletzt von baerchen (10. Februar 2015 um 06:02)