madmorgan Posted February 7, 2010 Share Posted February 7, 2010 Hello All, i want to have a edit box that a user can input text but i also want to to show him how much text space he has left. so the edit box will have a max text lenght of 1000 but i want the count down to show on the screen as well. hop you lot know what i want some knows how to do it please help thanks for your time. Link to comment Share on other sites More sharing options...
Minikori Posted February 7, 2010 Share Posted February 7, 2010 Hello All,i want to have a edit box that a user can input text but i also want to to show him how much text space he has left.so the edit box will have a max text lenght of 1000 but i want the count down to show on the screen as well.hop you lot know what i want some knows how to do it please help thanks for your time.Well, I spent about a minute in the help file and found GUICtrlSetLimit() and StringLen() For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
madmorgan Posted February 7, 2010 Author Share Posted February 7, 2010 how can i output the remaining length thats left Link to comment Share on other sites More sharing options...
madmorgan Posted February 7, 2010 Author Share Posted February 7, 2010 ok i have a go with those two functions i gan get the maths to work but i want the maths to show on screen but also i want to keep counting down as exted is enterd or up when text is removed. here is what i got. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $math = 0 #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1", 626, 444, 192, 124) $Edit1 = GUICtrlCreateEdit("", 72, 24, 385, 361) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Button1", 520, 168, 75, 25) $Label1 = GUICtrlCreateLabel("Text Space Left", 520, 248, 36, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 $read = GUICtrlRead($Edit1) $max = 1000 $len = StringLen($read) ;maths $maths = $max - $len MsgBox(0,"",$maths) GUICtrlSetData($Label1, $maths, 1) EndSwitch WEnd i cant get it to output the information and i want to keep updating when new text is enteded or removed. Link to comment Share on other sites More sharing options...
GodlessSinner Posted February 7, 2010 Share Posted February 7, 2010 (edited) expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $math = 0 Global $btn = "shown", $temp ="" #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1", 626, 444, 192, 124) $Edit1 = GUICtrlCreateEdit("", 72, 24, 385, 361) GUICtrlSetLimit(-1, 1000) GUICtrlSetData(-1, "") $Button2 = GUICtrlCreateButton("Button1", 520, 168, 75, 25) $Label1 = GUICtrlCreateLabel("1000", 520, 248, 36, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button2 $read = GUICtrlRead($Edit1) $max = 1000 $len = StringLen($read) ;maths $maths = $max - $len MsgBox(0,"",$maths) GUICtrlSetData($Label1, $maths, 1) EndSwitch $entered = GUICtrlRead($Edit1) If $entered <> "" And GUICtrlRead($Edit1)<> $temp Then $temp = GUICtrlRead($Edit1) GUICtrlSetData($Label1, 1000- StringLen($temp)) EndIf if $entered <> "" And $btn <> "shown" Then GUICtrlSetState($Button2, $GUI_ENABLE) $btn = "shown" ElseIf $entered = "" And $btn <> "hidden" Then GUICtrlSetState($Button2, $GUI_DISABLE) GUICtrlSetData($Label1, "1000") $btn = "hidden" EndIf WEnd Edited February 8, 2010 by Godless _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
madmorgan Posted February 8, 2010 Author Share Posted February 8, 2010 wow that works better than i thought it would thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now