Sign in to follow this  
Followers 0

Multi-line input boxes

12 posts in this topic

#1 ·  Posted

Hey everyone

Can inputboxes (e.g. $string=inputbox(etc.)) be mutlined? If so, how do I make them?

If not, what would be the best input method for a user to enter a multilined string without the use of a GUI edit box?

Thanks :)

Share this post


Link to post
Share on other sites



#2 ·  Posted

multilined string without the use of a GUI edit box?

just create a GUI with an edit :) There is no other way...

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

InputBox can only have 254 characters. However the Inputbox is a normal GUI with GUICtrlCreateInput so no they can't be multilined (atleast not the input, the message can if you use @crlf)

But you can make a custom Inputbox with a GUICtrlCreateEdit instead and some buttons.

But since you said without editbox you can always use a file and read from it :)

Edit: damn Andy were faster

Edited by Pain

Share this post


Link to post
Share on other sites

#4 ·  Posted

@aommaster

#Include <EditConstants.au3>

GuiCreate("GUI",400,400)
GuiCtrlCreateEdit("Edit",5,5,390,390,$ES_MULTILINE)
GuiSetState()

While 1
Sleep(250)
WEnd

Cheers, FireFox.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !

Share this post


Link to post
Share on other sites

#5 ·  Posted

Hmm.. so would the best way be by creating a child window with a multiline edit box, and pass the variable back to the main program once the user has completed the input?

Share this post


Link to post
Share on other sites

#6 ·  Posted

ClipGet


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

ClipGet

Doesn't suit my purpose, because the user has to input a custom set of lines that aren't copied from the clipboard Edited by aommaster

Share this post


Link to post
Share on other sites

#8 ·  Posted

@aommaster

#Include <EditConstants.au3>

GuiCreate("GUI",400,400)
GuiCtrlCreateEdit("Edit",5,5,390,390,$ES_MULTILINE)
GuiSetState()

While 1
Sleep(250)
WEnd

Cheers, FireFox.

Hi Firefox!

Didn't see your reply until I posted mine. Thanks for your code :)

Share this post


Link to post
Share on other sites

#9 ·  Posted

Doesn't suit my purpose, because the user has to input a custom set of lines that aren't copied from the clipboard

I have several scripts that prompt the user to enter data into a certain app - then either the user puts it into the clipboard or the script gets it from the edit control. It comes in handy if the info needs to retain formatting.

...but like you said - it might not work for your needs. You just really limited the options when you said no GUI :-)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#10 ·  Posted

...but like you said - it might not work for your needs. You just really limited the options when you said no GUI :-)

Yeah.. reason I wanted to avoid a GUI window is because this script is already running from a GUI, and because I'm not too comfortable with GUI coding just yes (I can only do the basic things such as define a control and make it do stuff, as well as read and write to it), I'm afraid that creating a child window would be a one way ticket to disaster :)

Oh well, here goes nothing... another new learning experience for me.

Thanks everyone!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

This should work just like inputbox:

$sText = ''
For $i = 0 To 5000
    $sText &= Chr(Random(65, 90, 1))
Next
MsgBox(0, '', _MLInputBox("Testbox", "Test", $sText, 0, 800, -1, -1) & @error)
InputBox("t", "")
;===============================================================================
;
; Function Name:   _MLInputBox(
; Description::    Multiline Inputbox
; Parameter(s):    same as Inputbox, but without Psswordchar
; Requirement(s):
; Return Value(s): same as InputBox
; Author(s):       Oscar, Prog@ndy
;
;===============================================================================
;
Func _MLInputBox($title, $prompt, $Default = "", $width = 0, $height = 0, $left = Default, $top = Default, $timeOut = 0, $hWnd = 0)
    Local $OnEventMode = Opt('GUIOnEventMode', 0)
    Local $text = ""
    If $width < 400 Then $width = 400
    If $height < 330 Then $height = 330
    Local $widthAddition = $width-400
    Local $heightAddition = $height-330
    Local $error = 0
    Local $hGui = GUICreate($title, $width, $height, $left, $top, 0x00C00000+0x00080000,0,$hWnd)
    If @error Then
        $error = 3
    Else
        GUICtrlCreateLabel($prompt, 5, 5, 390, 90)
        If @error Then $error = 3
        Local $Edit = GUICtrlCreateEdit($Default, 5, 105, 390+$widthAddition, 190+$heightAddition)
        If @error Then $error = 3
        Local $hOK = GUICtrlCreateButton('&OK', 70, 300+$heightAddition, 80, 25)
        If @error Then $error = 3
        Local $htime = GUICtrlCreateLabel('', 170, 305+$heightAddition, 50, 20)
        If @error Then $error = 3
        Local $hCancel = GUICtrlCreateButton('&Cancel', 230, 300+$heightAddition, 80, 25)
        If @error Then $error = 3
        GUISetState(@SW_SHOW, $hGui)
        If @error Then $error = 3
        Local $timer = TimerInit(), $s1, $s2, $msg
        Do
            $msg = GUIGetMsg(1)
            If $msg[1] = $hGui Then
            Switch $msg[0]
                Case 0xFFFFFFFD, $hCancel ; 0xFFFFFFFD = $GUI_EVENT_CLOSE
                    $error = 1
                    ExitLoop
                Case $hOK
                    ExitLoop
            EndSwitch
            EndIf


            If $timeOut > 0 And TimerDiff($timer) >= $timeOut Then $error = 2
            $s1 = Round(($timeOut - TimerDiff($timer)) / 1000)
            If $timeOut And $s1 <> $s2 Then
                GUICtrlSetData($htime, $s1 & "s")
                $s2 = $s1
            EndIf
        Until $error

        If Not $error Then $text = GUICtrlRead($Edit)
        GUIDelete($hGui)
        Opt('GUIOnEventMode', $OnEventMode)
    EndIf
    SetError($error)
    Return $text
EndFunc   ;==>_MLInputBox
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#12 ·  Posted

Thanks for that code! It's brilliant :)

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