GUI Input Zeichen maximum setzen

  • Also ich weiss ja auch nicht entweder bin ich zu doof zum suchen oder es hat einfach noch nie jemand gefragt...
    Aber kann ich bei einem Input irgendwo ein Maximum an eingebbaren Zeichen machen also z.B. wenn man jetzt ein Input mit einer Jahreszahl macht dass man dann nur max 4 Zeichen und am besten sogar nur Zahlen eingeben kann ^^

    MFG FireFlyer

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

    Einmal editiert, zuletzt von FireFlyer (27. Dezember 2007 um 21:38)

  • nice :)

    aber du meinst bestimmt die Funktion GUICtrlSetLimit... aber wurscht auch die hab ich gefunden xD

    Kann ich jetzt noch irgendwie definieren das man nur Zahlen von 01 - 31 z.B. beim Datum eingeben kann?

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • 1. Schau mal in die UDF von peethebee ich glaube die hat sowas gekonnt.
    2. Wenn die Meldung erst kommen soll wenn man auf Absenden, Bestätigen oder so was klickt, dann kann man ja ne If-Abfrage machen.

    Projekte: Keine größeren (und fertigen)
    Gegen Internetzensur:
    https://epetitionen.bundestag.de/index.php?acti…s;petition=3860
    (Zeichnungsfrist abgelaufen)
    __________________________________________________________________________________________________________________________________
    Dieser Beitrag wurde bereits 264 mal editiert, zuletzt von »Fast2« (30. Februar 2009, 12:99)

  • also wenns möglich ist gleich bei der eingabe kontrollieren, das ganze kann man ja in ne function reinhaun und die läuft dann halt inner schleife...

    aber wie geht denn das jetzt mit der UDF scite kennt des ja net einfach reinschreiben und des geht dann oder wie? Achso waynes interessiert :D
    hier mal mein Proggi:

    Spoiler anzeigen
    [autoit]

    #include
    #include
    #include
    #include

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

    Global $record, $now, $fenstername
    Global $server2, $serverpw2, $demoname2

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

    ;[Options]-----------------------------------------------------------------------------------------------
    AutoItSetOption("TrayIconHide", 1)
    AutoItSetOption("WinTitleMatchMode", 2)
    Opt("GUIOnEventMode", 1)
    ;[Options]-----------------------------------------------------------------------------------------------

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

    ;[Create_GUI ($main)]-----------------------------------------------------------------------------------------------
    $main = GUICreate( "Half-Live TV Client by FireFlyer", 450, 300, 100, 100)
    GUICtrlCreateLabel( "This is a help to configure your HLTV Proxy", 10, 8, 300, 20)
    GUICtrlCreateLabel( "You can get more help when you drive with your mouse over the text", 10, 25, 350, 20)
    ;[Create_GUI ($main)]-----------------------------------------------------------------------------------------------

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

    ;[Config_Read]-----------------------------------------------------------------------------------------------
    $servercfg = FileReadLine( "connect.cfg", 1)
    $pwcfg = FileReadLine( "connect.cfg", 2)
    $demo = FileReadLine( "connect.cfg", 3)
    $record2 = StringLeft( $demo, 6)
    $servercfg2 = StringMid( $servercfg, 9)
    $pwcfg2 = StringMid( $pwcfg, 16)
    $demo2 = StringMid( $demo, 8)
    ;[Config_Read]-----------------------------------------------------------------------------------------------

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

    ;[IP, PW, Name_Labels]-----------------------------------------------------------------------------------------------
    GUICtrlCreateLabel( "Server IP:", 10, 53, 100, 20)
    $server = GUICtrlCreateInput( $servercfg2, 120, 50, 150, 20)
    GUICtrlCreateLabel( "(Example: 85.214.40.16:27100)", 275, 53, 200, 20)

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

    GUICtrlCreateLabel( "Serverpassword:", 10, 83, 100, 20)
    $serverpw = GUICtrlCreateInput( $pwcfg2, 120, 80, 150, 20)
    GUICtrlCreateLabel( "(Example: Password)", 275, 83, 200, 20)

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

    GUICtrlCreateLabel( "Demoname:", 10, 112, 100, 20)
    $demoname = GUICtrlCreateInput( $demo2, 120, 110, 150, 20)
    ;GUICtrlCreateLabel( "(Example: Name)", 275, 112, 200, 20)
    $record = GUICtrlCreateCheckbox( "Record Demo", 280, 112, 100, 20)

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

    $heightctime = 142
    GUICtrlCreateLabel( "Current Date/Time: ", 10, $heightctime, 100, 20)
    $now2 = GUICtrlCreateLabel( $now, 120, $heightctime, 100, 20)
    ;[IP, PW, Name_Labels]-----------------------------------------------------------------------------------------------

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

    ;[START_TIME]-----------------------------------------------------------------------------------------------
    GUICtrlCreateLabel( "Start-time for HLTV:", 10, 172, 100, 20)
    $sleftdate = 119
    $stopdate = 170
    $sday2 = GUICtrlCreateInput( @MDAY, $sleftdate, $stopdate, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ".", $sleftdate + 22, $stopdate + 5, 5, 20)
    $smonth2 = GUICtrlCreateInput( @MON, $sleftdate + 27, $stopdate, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ".", $sleftdate + 49, $stopdate + 5, 5, 20)
    $syear2 = GUICtrlCreateInput( @YEAR, $sleftdate + 54, $stopdate, 32, 20, $ES_NUMBER)

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

    $slefttime = 220
    $stoptime = 170
    $shour2 = GUICtrlCreateInput( @HOUR, $slefttime, $stoptime, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ":", $slefttime + 22, $stoptime + 2, 5, 20)
    $smin2 = GUICtrlCreateInput( @MIN, $slefttime + 27, $stoptime, 20, 20, $ES_NUMBER)
    $stimercheckbox2 = GUICtrlCreateCheckbox( "Use Timer", 280, 170, 70, 20)

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

    GUICtrlSetLimit($sday2, 2)
    GUICtrlSetLimit($smonth2, 2)
    GUICtrlSetLimit($syear2, 4)
    GUICtrlSetLimit($shour2, 2)
    GUICtrlSetLimit($smin2, 2)
    ;[START_TIME]-----------------------------------------------------------------------------------------------

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

    ;[END_TIME]-----------------------------------------------------------------------------------------------
    GUICtrlCreateLabel( "End-time for HLTV:", 10, 205, 100, 20)
    $eleftdate = 119
    $etopdate = 201
    $eday2 = GUICtrlCreateInput( @MDAY, $eleftdate, $etopdate, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ".", $eleftdate + 22, $etopdate + 5, 5, 20)
    $emonth2 = GUICtrlCreateInput( @MON, $eleftdate + 27, $etopdate, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ".", $eleftdate + 49, $etopdate + 5, 5, 20)
    $eyear2 = GUICtrlCreateInput( @YEAR, $eleftdate + 54, $etopdate, 32, 20, $ES_NUMBER)

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

    $elefttime = 220
    $etoptime = 201
    $ehour2 = GUICtrlCreateInput( @HOUR, $elefttime, $etoptime, 20, 20, $ES_NUMBER)
    GUICtrlCreateLabel( ":", $elefttime + 22, $etoptime + 2, 5, 20)
    $emin2 = GUICtrlCreateInput( @MIN, $elefttime + 27, $etoptime, 20, 20, $ES_NUMBER)
    $etimercheckbox2 = GUICtrlCreateCheckbox( "Use Timer", 280, 201, 70, 20)

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

    GUICtrlSetLimit($eday2, 2)
    GUICtrlSetLimit($emonth2, 2)
    GUICtrlSetLimit($eyear2, 4)
    GUICtrlSetLimit($ehour2, 2)
    GUICtrlSetLimit($emin2, 2)
    ;[END_TIME]-----------------------------------------------------------------------------------------------

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

    ;[Buttons]-----------------------------------------------------------------------------------------------
    $heightbutton = 250
    $start = GUICtrlCreateButton( "Start HLTV", 10, $heightbutton, 75, 25)
    GUICtrlSetOnEvent($start, "start_hltv")

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

    $end = GUICtrlCreateButton( "End HLTV", 90, $heightbutton, 75, 25)
    GUICtrlSetOnEvent($end, "end_hltv")

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

    $folder = GUICtrlCreateButton( "Demo-Folder", 170, $heightbutton, 75, 25)
    GUICtrlSetOnEvent($folder, "Folder")

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

    $options = GUICtrlCreateButton( "Advanced Options", 250, $heightbutton, 110, 25)
    GUICtrlSetOnEvent($options, "Optionen_fenster")

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

    $exit = GUICtrlCreateButton( "Exit", 365, $heightbutton, 75, 25)
    GUICtrlSetOnEvent($exit, "GUI_Exit")
    GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Exit")
    ;[Buttons]-----------------------------------------------------------------------------------------------

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

    GUISetState(@SW_SHOW, $main)

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

    ;[GUI_Create ($options)]-----------------------------------------------------------------------------------------------
    $optionen = GUICreate( "Half-Live TV Advanced Options by FireFlyer", 450,500,300,300)
    ;LABELS
    GUICtrlCreateLabel( "Here you can modify the most important options", 10, 10, 300, 15)
    GUICtrlCreateLabel( "\\Name-Settings", 10, 40, 100, 15)
    GUICtrlCreateLabel( "Name", 10, 60, 100, 15)
    GUICtrlCreateLabel( "Hostname", 10, 80, 100, 15)
    GUICtrlCreateLabel( "\\Password-Settings", 10, 110, 100, 15)
    GUICtrlCreateLabel( "Admin-Password", 10, 130, 100, 15)
    GUICtrlCreateLabel( "Server-Password", 10, 150, 100, 15)
    GUICtrlCreateLabel( "Proxy-Password", 10, 170, 100, 15)
    GUICtrlCreateLabel( "Spectator-Password", 10, 190, 100, 15)
    GUICtrlCreateLabel( "\\Connection-Settings", 10, 220, 100, 15)
    GUICtrlCreateLabel( "Rate", 10, 240, 100, 15)
    GUICtrlCreateLabel( "Updaterate", 10, 260, 100, 15)
    GUICtrlCreateLabel( "MaxRate", 10, 280, 100, 15)
    GUICtrlCreateLabel( "MaxLoss", 10, 300, 100, 15)
    ;INPUTS
    GUISetState(@SW_HIDE, $optionen)
    ;[GUI_Create ($options)]-----------------------------------------------------------------------------------------------

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

    Func start_hltv()
    $fenstername = "HLTV - "&$server2
    FileDelete( "connect.cfg" )
    FileWriteLine ( "connect.cfg", "connect "&$server2)
    FileWriteLine ( "connect.cfg", "serverpassword "&$serverpw2)
    If GuiCtrlRead($record) = $GUI_CHECKED Then
    FileWriteLine ( "connect.cfg", "record "&$demoname2)
    EndIf
    sleep(100)
    If Not ProcessExists("hltv.exe") Then
    run( "hltv.exe")
    WinActivate( "HLTV - ")
    sleep(1000)
    WinActivate( "HLTV")
    Send( "exec connect.cfg")
    sleep(1000)
    Send("{Enter}")
    sleep(2000)
    WinSetState("HLTV - ", "", @SW_MINIMIZE)
    EndIf
    EndFunc

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

    Func end_hltv()
    WinActivate("HLTV - ")
    If WinActive ($fenstername) Or WinActive ("HLTV - offline") Then
    Send( "exit")
    sleep(300)
    Send( "{ENTER}")
    $etimercheckbox = GUICtrlRead( $etimercheckbox2)
    If $etimercheckbox = $GUI_CHECKED Then
    GUICtrlSetState($etimercheckbox2, $GUI_UNCHECKED)
    EndIf
    Else
    MsgBox(0, "Error", "HLTV is not opened")
    EndIf
    EndFunc

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

    Func Folder()
    run( @Windowsdir&"\explorer.exe "&@WorkingDir&"\cstrike")
    EndFunc

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

    Func Optionen_fenster()
    GUISetState(@SW_SHOW, $optionen)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Optionen_fenster_schliessen")
    EndFunc

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

    Func Optionen_fenster_schliessen()
    GUISetState(@SW_HIDE, $optionen)
    EndFunc

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

    Func GUI_Exit()
    If ProcessExists( "hltv.exe") Then
    MsgBox(0, "Attention", "HLTV is already running!")
    Else
    Exit
    EndIf
    EndFunc

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

    Func GetPos()
    $a = GUIGetCursorInfo($main)
    ;_ArrayDisplay($a)
    Select
    Case not @error And $a[4] = "5" ;server IP
    ToolTip("This is the IP where the HLTV Proxy will connect on")

    Case not @error And $a[4] = "8" ;server PW
    ToolTip("If the GameServer is password-protected type the password in here")

    Case not @error And $a[4] = "11" ;DemoName
    ToolTip("Demos will be saved with the NAME-YYMMDDhhmm-map.dem")

    Case Else
    ToolTip("")
    EndSelect
    EndFunc

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

    Func GetTime()
    $now = _Now()
    ControlSetText( "", "", $now2, $now)
    Sleep(500)
    EndFunc

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

    Func Demo_Checkbox()
    $server2 = GUICtrlRead( $server, 1)
    $serverpw2 = GUICtrlRead( $serverpw, 1)
    $demoname2 = GUICtrlRead( $demoname, 1)
    If $demoname2 = "" Then
    GUICtrlSetState( $record, $GUI_UNCHECKED)
    Else
    GUICtrlSetState( $record, $GUI_CHECKED)
    EndIf
    EndFunc

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

    Func stime()
    $sday = GUICtrlRead( $sday2)
    $smonth = GUICtrlRead( $smonth2)
    $syear = GUICtrlRead( $syear2)
    $shour = GUICtrlRead( $shour2)
    $smin = GUICtrlRead( $smin2)
    $stimercheckbox = GUICtrlRead( $stimercheckbox2)
    If $stimercheckbox = $GUI_CHECKED Then
    If $sday = @MDAY And $smonth = @MON And $syear = @YEAR And $shour = @HOUR And $smin = @MIN And @SEC = 00 Then
    start_hltv()
    EndIf
    EndIf
    EndFunc

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

    Func etime()
    $eday = GUICtrlRead( $eday2)
    $emonth = GUICtrlRead( $emonth2)
    $eyear = GUICtrlRead( $eyear2)
    $ehour = GUICtrlRead( $ehour2)
    $emin = GUICtrlRead( $emin2)
    $etimercheckbox = GUICtrlRead( $etimercheckbox2)
    If $etimercheckbox = $GUI_CHECKED Then
    If $eday = @MDAY And $emonth = @MON And $eyear = @YEAR And $ehour = @HOUR And $emin = @MIN And @SEC = 00 Then
    end_hltv()
    EndIf
    EndIf
    EndFunc

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

    While 1
    GetPos()
    GetTime()
    Demo_Checkbox()
    stime()
    etime()
    WEnd

    [/autoit]


    </Date.au3></Array.au3></File.au3></GUIConstants.au3>

    </Date.au3></Array.au3></File.au3></GUIConstants.au3>

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

    Einmal editiert, zuletzt von FireFlyer (27. Dezember 2007 um 14:45)

  • Ja, das ist egal, ob Scite das kennt :rolleyes:
    Du musst nur die Datei mit der UDf mit include einbinden und dann die Fuktionen aufrufen

  • hab mir das ganze selbst inner funktion geschrieben xD

    Spoiler anzeigen
    [autoit]

    Func checkinput()
    $sday = GUICtrlRead( $sday2)
    $smonth = GUICtrlRead( $smonth2)
    $syear = GUICtrlRead( $syear2)
    $shour = GUICtrlRead( $shour2)
    $smin = GUICtrlRead( $smin2)
    $eday = GUICtrlRead( $eday2)
    $emonth = GUICtrlRead( $emonth2)
    $eyear = GUICtrlRead( $eyear2)
    $ehour = GUICtrlRead( $ehour2)
    $emin = GUICtrlRead( $emin2)
    If $sday < 1 Or $eday < 1 And $sday <> "" And $eday <> "" Then
    MsgBox(0, "Error", "This number is too low")
    GUICtrlSetData( $sday2, @MDAY)
    GUICtrlSetData( $eday2, @MDAY)
    EndIf
    If $sday > 31 Or $eday > 31 Then
    MsgBox(0, "Error", "This number is too high")
    GUICtrlSetData( $sday2, @MDAY)
    GUICtrlSetData( $eday2, @MDAY)
    EndIf
    If $smonth < 1 Or $emonth < 1 And $smonth <> "" And $emonth <> "" Then
    MsgBox(0, "Error", "This number is too low")
    GUICtrlSetData( $smonth2, @MON)
    GUICtrlSetData( $emonth2, @MON)
    EndIf
    If $smonth > 12 Or $emonth > 12 Then
    MsgBox(0, "Error", "This number is too high")
    GUICtrlSetData( $smonth2, @MON)
    GUICtrlSetData( $emonth2, @MON)
    EndIf
    If $shour > 23 Or $ehour > 23 Then
    MsgBox(0, "Error", "This number is too high")
    GUICtrlSetData( $shour2, @HOUR)
    GUICtrlSetData( $ehour2, @HOUR)
    EndIf
    If $smin > 59 Or $emin > 59 Then
    MsgBox(0, "Error", "This number is too high")
    GUICtrlSetData( $smin2, @MIN)
    GUICtrlSetData( $emin2, @MIN)
    EndIf
    EndFunc

    [/autoit]

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D