Sicherstellung von Feldauswahl ?

  • Bitte wie stelle ich dies an, damit die "Feldauswahl" geprüft wird, bevor ein leeres MsgBox Fentser aufklappt.
    Danke
    MC

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt('MustDeclareVars', 1)
    Example1()
    Func Example1()

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

    Local $hname, $section, $msg, $ButtonMsg, $ButtonEnd
    GUICreate(" GUI ", 200, 250) ; will create a dialog box that when displayed is centered
    GUICtrlCreateLabel("HostName ", 11, 80)

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

    $hname = GUICtrlCreateCombo("", 10, 103)
    $section = IniReadSection("muster.ini", "HostName")
    For $i = 1 To UBound($section) - 1
    GUICtrlSetData($hname, $section[$i][1])
    Next
    $ButtonMsg = GUICtrlCreateButton("Button Msg", 20, 150)
    $ButtonEnd = GUICtrlCreateButton("Button End", 90, 150)

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

    GUISetState(@SW_SHOW) ; will display an empty dialog box
    While 1
    $msg = GUIGetMsg()
    Select

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

    ;Case $GUI_EVENT_CLOSE
    ; ExitLoop

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

    Case $msg = $ButtonMsg

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

    ;GUICtrlSetState($ButtonMsg, $GUI_ENABLE)
    If GUICtrlRead($msg = $ButtonMsg) then
    MsgBox(1, "", "Feld zuerst ausfüllen")
    EndIf

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

    MsgBox(1, "", GUICtrlRead($hname))

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

    Case $msg = $ButtonEnd
    ExitLoop ;MsgBox(0, 'Testing', 'Button 2 was pressed')
    EndSelect
    WEnd
    EndFunc
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    [/autoit]
    • Offizieller Beitrag

    Meinst Du sowas:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>

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

    Opt('MustDeclareVars', 1)
    Example1()
    Func Example1()
    Local $hname, $section, $msg, $ButtonMsg, $ButtonEnd
    GUICreate(" GUI ", 200, 250) ; will create a dialog box that when displayed is centered
    GUICtrlCreateLabel("HostName ", 11, 80)

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

    $hname = GUICtrlCreateCombo("", 10, 103)
    $section = IniReadSection("muster.ini", "HostName")
    For $i = 1 To UBound($section) - 1
    GUICtrlSetData($hname, $section[$i][1])
    Next
    $ButtonMsg = GUICtrlCreateButton("Button Msg", 20, 150)
    $ButtonEnd = GUICtrlCreateButton("Button End", 90, 150)

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

    GUISetState(@SW_SHOW) ; will display an empty dialog box
    While 1
    If GUICtrlRead($hname) <> "" Then
    If BitAND(GUICtrlGetState($ButtonMsg), $GUI_DISABLE) Then GUICtrlSetState($ButtonMsg, $GUI_ENABLE)
    Else
    If BitAND(GUICtrlGetState($ButtonMsg), $GUI_ENABLE) Then GUICtrlSetState($ButtonMsg, $GUI_DISABLE)
    EndIf
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $ButtonEnd
    Exit
    Case $ButtonMsg
    MsgBox(1, "", GUICtrlRead($hname))
    EndSwitch
    WEnd
    EndFunc ;==>Example1

    [/autoit]