Jump to content
Sign in to follow this  
Surviver

problems on GUiCtrlCreateEdit (again )

Recommended Posts

Surviver

I have the code that you see, it works good but i have 2 questions:

1)Why if i want to pass on a new line, i can't?

2)On The password input for the encrypt function i want to force the user to enter minimum one character, but i want also that chars to be masked with the "*" character

Here is the code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include<GuiEdit.au3>
GUICreate("Ducky's freaky Editor", 600, 600, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
$filemenu = GUICtrlCreateMenu("Meniu")
$exititem = GUICtrlCreateMenuItem("Iesire", $filemenu)
$hEdit_1 = GUICtrlCreateEdit("", 10, 5, 580, 500, BitOR($WS_VSCROLL, $WS_HSCROLL))
_GUICtrlEdit_SetLimitText($hEdit_1,0)
GuiCtrlCreateButton("Encrypt", 10, 520, 70, 20)
GUISetState(@SW_SHOW)
While 1 
    $msg = GUIGetMsg() 
    Select 
        Case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
        Case $msg = $exititem
            ExitLoop    
        Case $msg = $encrypt
            $passul = InputBox("Password", "Enter the password desired" & @CRLF"MINIMUM 1 caracter!!!", "", "*")
            $sNewtext = ""
            $sText = GUICtrlRead($hEdit_1)
            $aLines = StringSplit($sText, @CRLF, 1)
            For $i = 1 To $aLines[0]
                $sNewtext &= _StringEncrypt(0, $aLines[$i], $passul) & @CRLF
            Next
            GUICtrlSetData($hEdit_1, $sNewtext)

    EndSelect
WEnd

Sorry for the edited code but now that i have solved the problem, i edited the source for private reasons.But i have not deleted the problems in order that the others could undesrstand what was my mistakes.

Edited by AutoBot

Share this post


Link to post
Share on other sites
Melba23

AutoBot,

Why if i want to pass on a new line, i can't?

You set the Edit style to BitOR($WS_VSCROLL, $WS_HSCROLL). This overwrites the default style (which actually includes those 2 styles) and so removes the default $ES_MULTILINE style you need to create new lines. :P

Remember that many AutoIt controls have the necessary styles built-in - look at the relevant page in the Help file to see what they are.

Remember also that if you specify a particular style, you overwrite the existing style value. So if you want an additional style, you have to respecify all of the exisitng styles as well - or you end up with just the new style on its own. :blink:

password input for the encrypt function

Read the Help file for InputBox:

"password char - [optional] The character to replace all typed characters with in the display. If you want the actual typed character to appear, define with an empty string ("") (default) or a space for the first character."

You had " M" for this parameter - the first character is a space and so, just as the help file tells you, you get the actual typed characters. If you want "*" instead, just replace the space with it: "*M". :

All clear? ;)

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
Surviver

Clear like a clean water, thank you again, i didn't knew that i had made a mistake overwriting the stiles. Thank you again.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.