Sign in to follow this  
Followers 0
rcrosby

need help with text in an edit box

2 posts in this topic

I need help i'm a newbie and I wanted to know if there was a way to display the contents of a text file in an edit box when a user presses a button.

Share this post


Link to post
Share on other sites



here's one way.

#include <GUIConstants.au3>

$filename = @ScriptDir & '\myfile.txt'

GUICreate("My GUI edit", 500, 500)  ; will create a dialog box that when displayed is centered

$myedit = GUICtrlCreateEdit("", 10, 10, 480, 450, $ES_AUTOVSCROLL + $WS_VSCROLL)
$btn = GUICtrlCreateButton("Read file", 225, 475, 90, 20)
GUISetState()


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $btn
            GUICtrlSetData($myedit, FileRead($filename, FileGetSize($filename)))
    EndSelect
    
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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