hcI Posted January 21, 2017 Posted January 21, 2017 (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 January 21, 2017 by Melba23
Moderators Melba23 Posted January 21, 2017 Moderators Posted January 21, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hcI Posted January 21, 2017 Author Posted January 21, 2017 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.
Moderators Melba23 Posted January 21, 2017 Moderators Posted January 21, 2017 hcl, How about this: expandcollapse popup#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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hcI Posted January 21, 2017 Author Posted January 21, 2017 (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 January 21, 2017 by hcI
Moderators Melba23 Posted January 21, 2017 Moderators Posted January 21, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hcI Posted January 21, 2017 Author Posted January 21, 2017 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 !
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