hcI

[Solved] EditBox line limit ?

7 posts in this topic

#1 ·  Posted (edited)

Hello everyone !

I'm making a little password generator with save function.

And i would like to set a line limit at 25.

For my script, the user have to enter a name in "$input1" and click on the button "$btn_save" to display it in the editbox "$edit1".

The user can't edit himself because the edit box have $ES_READONLY

If someone know how, Thanks you !

 

PS: I've already looked in the help and didn't find anything..

Edited by Melba23

Share this post


Link to post
Share on other sites



hcl,

What do you want to happen when 25 lines have been added to the edit? Start removing the earlier entries to allow for the later ones to be added? Prevent the user from adding any more?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I would like that the 26th line become the 1st line, next one the 2nd..

Is it possible ? I've absolutely no idea how to do this.

Share this post


Link to post
Share on other sites

hcl,

How about this:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <String.au3>

; Set limit of lines to write
Global $iLimit = 5
; Create that many empty lines in the edit
Global $sInitial = _StringRepeat(@CRLF, $iLimit)
; Set line counter
Global $iCounter = 1

; Create the GUI
$hGUI = GUICreate("Test", 500, 500)

$cInput = GUICtrlCreateInput("", 10, 10, 400, 20)

$cEdit = GUICtrlCreateEdit($sInitial, 10, 50, 400, 300, $ES_READONLY)

$cSave = GUICtrlCreateButton("Save", 10, 450, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cSave

            ; Read and clear the input
            $sNewtext = GUICtrlRead($cInput)
            GUICtrlSetData($cInput, "")

            ; Read the current edit content
            $sCurrentText = GUICtrlRead($cEdit)
            ; Convert to an array
            $aCurrText = StringSplit($sCurrentText, @CRLF, $STR_ENTIRESPLIT)
            ; Insert the next line
            $aCurrText[$iCounter] = $sNewtext
            ; Reconvert to a string
            $sCurrText = _ArrayToString($aCurrText, @CRLF, 1)
            ; Reload the string to the edit
            GUICtrlSetData($cEdit, $sCurrText)

            ; Advance tghe counter and reset if required
            $iCounter += 1
            If $iCounter > $iLimit Then
                $iCounter = 1
            EndIf

            ; Reset focus to the input]
            GUICtrlSetState($cInput, $GUI_FOCUS)

    EndSwitch

WEnd

Please ask if you have any questions, or if it does not meet your requirements.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Omg ! That's excactly what I want/need !!

I never thinked about the convert into array. I was searching in the helpfile if a thing like _GUICtrlEdit_WriteLine was existing..

That's cool man, thanks you Melba23 !

Edit: Just a last question, how to put my problem as resolved.. ?

Edited by hcI

Share this post


Link to post
Share on other sites

hcI,

Glad I could help.

Quote

how to put my problem as resolved.. ?

Edit the first post and that allows you to change the title too. But I have already done it for you.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
1 minute ago, Melba23 said:

Edit the first post and that allows you to change the title too. But I have already done it for you.

 

Okay

Thanks you again you saved my day !

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

  • Similar Content

    • olmanRvr
      By olmanRvr
      I want to show or hide a edit control depending if a radio button is checked or not.The following Autoit code appears semantically ok but not working.Can anyone please help?
      thanks
      olmar
      While 1 $nMsg = GUIGetMsg() $isradioChk=GUICtrlRead($radio_AbsP);checked=1,not checked=4 Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $isradioChk If $isradioChk<==1 Then GUICtrlSetState($edit_AbsP,$GUI_SHOW) GUICtrlSetState($edit_RelP,$GUI_HIDE) Else GUICtrlSetState($edit_AbsP,$GUI_HIDE) GUICtrlSetState($edit_RelP,$GUI_SHOW) EndIf Case $usrPrefs EndSwitch WEnd  
    • Comboku
      By Comboku
      Hi Guys,
       
      quick dumb question that i could not find an answer to.
      I created an EditBox  with the Style $ES_LEFT. I would like to "add" the $WS_EX_TRANSPARENT style so i can use to box without the borders.
      My goal is to have a multi line input that automatically breaks into the next line without the sliders or boarders essentially.
      i have tried:
      $iInput = GUICtrlCreateEdit("Hi", 0, 200, 601, 81, BitOR($ES_LEFT,  $WS_EX_TRANSPARENT)) But it doesn't seem to work. Do you know maybe a style that would fit what i was searching for?
    • Robdog1955
      By Robdog1955
      I am trying to use IE.au3 UDF to auto fill a webpage. All goes well until I get to an editbox that appears to be a javascript. I am attaching a pic of the editbox. (I would be glad to add any other information needed to help me past this last hurdle in my script. I'm just not sure what questions you have to help me with this.)

    • marko001
      By marko001
      Hi all guys,
      I'm trying to find a solution for the following:
      I have an Editbox

      $CH_Edit = GUICtrlCreateEdit("", 71, 40, 81, 353, BitOR($WS_VSCROLL,$ES_WANTRETURN)) $CH_Close = GUICtrlCreateButton("Save&Close", 70, 408, 75, 25)  
      and I would like to pass to an array all the datas inside, row by row.
      i.e. if I have in the editbox
      John-Holder
      Frank-MCGregor
      Alex-Dentis
      I would like to have, once Button has been clicked,

      dm $names[100][2] ; fixed or it would be better dinamic based on the row of the editbox  
      and

      $names[0][0]=John $names[0][1]=Holder $names[1][0]=Frank $names[1][1]=MCGregor $names[2][0]=Alex $names[2][1]=Dentis  
      Can you please help me to solve this?
      Thanks in advance,
      Marco
    • DicatoroftheUSA
      By DicatoroftheUSA
      I am looking for a way to create a combobox that drops under the cursor of an edit box. In the sort of way scite works when typing out a function. I would like to use it for predictive text, below is an what I am going for.

      I would appreciate suggestions on how to attack this problem. Right now I am thinking about just creating a combobox and destoying it, or moving and hiding it. I am drawing up an example, if I get it working I will post it.