Sign in to follow this  
Followers 0
TheAutomator

Disable edit character limit?

5 posts in this topic

#1 ·  Posted (edited)

Hi, simple question actually:

How to disable the character limit for an edit control?

Want unlimited-length (or as much as possible)

I know the GUICtrlSetLimit() function but i want to disable the limit, not set one...

Any ideas?

I thought there was some sort of autoit constant for this or something but cant find what i'm looking for.

Edited by TheAutomator

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

There are always limits.

https://www.autoitscript.com/autoit3/docs/appendix/LimitsDefaults.htm

 

and this may help

https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetLimit.htm

i think the max parameter may set it to max by default, eventhough that is not described,  may be stretching but i think it is an implementation of this:

http://msdn.microsoft.com/en-us/library/95zx4bc4.aspx

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

There are always limits.

https://www.autoitscript.com/autoit3/docs/appendix/LimitsDefaults.htm

 

and this may help

https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetLimit.htm

i think the max parameter may set it to max by default, eventhough that is not described,  may be stretching but i think it is an implementation of this:

http://msdn.microsoft.com/en-us/library/95zx4bc4.aspx

 

Hello boththose  :),

I came across the first two links you provided but I thought there was a constand or such in autoit to set it to the max limit..

If you take a look at notepad.exe for example, what would be the limit there?

Or code editors?

A long time ago I saw a topic where someone omitted the character limit and I used it back then for making my own text editor but

I can't find it anymore.  :huh2:

Anyways, thanks for the reply.

[EDIT:]

I think it was $EM_EXLIMITTEXT or something, could that be?

I have to search which include has that constant if i'm right..

[EDIT:]

Nope, didn't work..

TheAutomator

Edited by TheAutomator

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If you take a look at notepad.exe for example, what would be the limit there?

 

 

i have to use VIM when it starts reaching the limits of my memory, but thats a whole seperate app.  For an edit control, your limit would still be the string size limit, unless you can chunk data back out of the control.

Good find, here it is wrapped for rich edit boxes.  I thought rich edit boxes had 64k but the helpfile states that this is used to exceed the 32k barrier (which was my search)...

https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlRichEdit_SetLimitOnText.htm

Edited by boththose
1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hi dears
      How are you?
      I have a question, to you please.
      How do I create an edit box for numbers only and does not accept letters? using autoit
      greetings to all
      I hope you help ME
      Thanks to all in advance
    • Simpel
      By Simpel
      Hi,
      I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background.
      But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely.
      #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions.
      Regards, Conrad
    • Chimp
      By Chimp
      Given an "Edit control" with Horizontal and Vertical scroll bars, setted with a monospace font,
      How can I know:
      1) the exact client area dimension (excluding the surface of the Vert and Horiz. scroll bars )
      2) the dimensions (in pixel or whatever) of the hidden portions of the "Edit control" that are on the right and/or on the left and/or over the top and/or below the bottom of the visible part?, that is:
      if the content of the Edit control is completly visible, then there are not hidden portions, while if the content of the control is biggher of the visible area, then there are hidden parts. How to know the dimensions of the not visible portions of the Edit control  on any given moment while I'm  scrolling vertically and/or horizzontaly or if I change the dimensions of the font as well?
      For example, when I set the Font dimension = 7, the whole text is visible, so the scrollbars are grayed out and parameters of the hidden parts should be all 0.
      Since I'm sure that my explanation in english is not clear, I post this short script to show in practice the question:
      Thanks for any suggestion.
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $aData Local $Char = " 1 2 3 4 5 6 7 8" & @CRLF $Char &= "12345678901234567890123456789012345678901234567890123456789012345678901234567890" & @CRLF For $i = 3 To 22 $Char &= StringFormat('%02i', $i) & _StringReplicate(" ", 7) & "|" & _StringReplicate(" |", 7) & @CRLF Next Global $MyGui = GUICreate("", 600, 430) Global $hEdit1 = GUICtrlCreateEdit($Char, 0, 0, 500, 300, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_READONLY, $ES_MULTILINE)) GUICtrlSetFont(-1, 7, 0, 0, "Courier New") GUICtrlSetBkColor($hEdit1, 0xffffff) Local $idRadio1 = GUICtrlCreateRadio("Font size 7", 505, 10, 120, 20) Local $idRadio2 = GUICtrlCreateRadio("Font size 10", 505, 40, 120, 20) Local $idRadio3 = GUICtrlCreateRadio("Font size 12", 505, 70, 120, 20) Local $idRadio4 = GUICtrlCreateRadio("Font size 16", 505, 100, 120, 20) GUICtrlSetState($idRadio1, $GUI_CHECKED) GUICtrlCreateLabel("pixel hidden on the left : " & @CRLF & _ "pixel hidden on the right : " & @CRLF & _ "pixel hidden over the top : " & @CRLF & _ "pixel hidden below bottom : " & @CRLF & _ "Width of the edit : " & @CRLF & _ "Height of the edit : ", 5, 305, 400, 150) GUICtrlSetFont(-1, 12, 0, 0, "Courier New") Local $hParameters = GUICtrlCreateLabel("", 300, 305, 200, 150) GUICtrlSetFont(-1, 12, 0, 0, "Courier New") GUISetState() While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE End() Case $iMsg = $idRadio1 GUICtrlSetFont($hEdit1, 7, 0, 0, "Courier New") Case $iMsg = $idRadio2 GUICtrlSetFont($hEdit1, 10, 0, 0, "Courier New") Case $iMsg = $idRadio3 GUICtrlSetFont($hEdit1, 12, 0, 0, "Courier New") Case $iMsg = $idRadio4 GUICtrlSetFont($hEdit1, 16, 0, 0, "Courier New") EndSelect $aData = _CheckEdit($hEdit1) ; this should return actual parameters of the Edit <----- ??? how to get this data ??? GUICtrlSetData($hParameters, $aData[0] & @CRLF & $aData[1] & @CRLF & $aData[2] & @CRLF & $aData[3] & @CRLF & $aData[4] & @CRLF & $aData[5]) WEnd Func _CheckEdit($hEdit1) ; <----- ??? how to get this data about the passed Edit ??? Local $aData[6] $aData[0] = "???" ; Hidden pixels on the left $aData[1] = "???" ; Hidden pixels on the right $aData[2] = "???" ; Hidden pixels over the top $aData[3] = "???" ; Hidden pixels below bottom $aData[4] = "???" ; Width of the visible portion of the Edit (without scrollbar surface) $aData[5] = "???" ; Height of the visible portion of the Edit (without scrollbar surface) Return $aData EndFunc ;==>_CheckEdit ; returns one or more chars replicated n times ; Example: ConsoleWrite(_StringReplicate('*', 5) & @CRLF) Func _StringReplicate($sChars = "", $iRepeats = 0) $sChars = String($sChars) $iRepeats = Int(Abs(Number($iRepeats))) Return StringReplace(StringFormat('%' & $iRepeats & 's', ""), " ", $sChars) EndFunc ;==>_StringReplicate Func End() If WinActive("[ACTIVE]") = $MyGui Then Exit EndIf EndFunc ;==>End  
    • TheDcoder
      By TheDcoder
      Hello! I think the thread title is obvious enough , Here is my code:
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 290, 139, 192, 124) $Edit1 = GUICtrlCreateEdit("Test", 8, 8, 273, 121, $ES_READONLY) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
      Thanks in advance, TD
    • Rhazz
      By Rhazz
      Hello. First of all, my full code:
      #include <WinAPI.au3> #include <File.au3> #include <String.au3> Local $aFiles, $IntOrFloat Local $aFileToRead = _WinAPI_GetOpenFileName("Open file to read", "Text Files (*.txt)") Local $aFinalFile = _WinAPI_GetSaveFileName("How do you want to save the file?", "Text Files (*.txt)") Local $sFilenameWithoutExtension = _StringBetween($aFinalFile[2],"",".") Local $sLinesPerLine = InputBox("Lines Per Line", "How many lines per line do you want?","","") Local $sCountLines = _FileCountLines($aFileToRead[2]) If ($sCountLines/$sLinesPerLine) >= 1 Then ; When the division result is a number with decimal, there will be less words in the last file and the script won't create it , therefore I add 1 to the result to prevent a file lack. Am I wrong? For example: if user introduces 3 the operation will be "4/3=1.33" and I need two files, the first "line1,line2,line3" and the second "line4". $IntOrFloat = $sCountLines/$sLinesPerLine Else $IntOrFloat = ($sCountLines/$sLinesPerLine) + 1 EndIf For $i = 1 To $IntOrFloat MsgBox(0,"", "Creating file " & $i) $aFiles = $aFinalFile[1] & "\" & $sFilenameWithoutExtension[0] & "-" & $i & ".txt" _FileCreate($aFiles) FileOpen($aFiles,2) For $a = ( ( ( $i - 1 ) * $sLinesPerLine ) + 1 ) To ( $i * $sLinesPerLine ) FileWrite($aFinalFile[2],FileReadLine($aFileToRead[2], $a) & ",") Next FileClose($aFiles) Next MsgBox(0,"Done","Done") With it I want to read a text file with a lot of lines and I wanna split it in multiple files with multiple lines (of the first file) in each line, separated by commas.
      For example: the user executes the script and selects a text file to open that contains:
      Then, the user selects the path and name of the result files. Suppose "C:\result.txt"
      Finally, the user introduces the number of lines per line (lines of the initial text file to each line of the result text files). Suppose the user enters 2.
      So far my code works fine. But I tried to code a loop for do (continuing the example):
      Start first loop repetition. Create "C:\result.-1.txt", and write on it "Line 1 asdf,Line 2 asdf" End first loop repetition. Start second loop repetition. Create "C:\result.-2.txt", and write on it "Line 3 asdf,Line 4 asdf" End second loop repetition. But my code results (continuing the example) in three files created:
      C:\result.txt that contains "Line 1 asdf,Line 2 asdf,Line 3 asdf,Line 4 asdf," C:\result.-1.txt that contains nothing. C:\result.-2.txt that contains nothing. Where is the error? I can't understand where is it...