Sign in to follow this  
Followers 0
tehsage

GUICtrlCreateEdit,FileOpenDialog,etc

5 posts in this topic

Yeah, I'm pretty oblivious. I'm having a little trouble with my program right now. Currently, I'm working on a basic text editor. I'm not exactly sure it's all possibly, but I'm trying anyway. =/ Anyway, this is what I have.

#include <GUIConstants.au3>

$MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"

GUICreate("Text Editor V1.0") ; will create a dialog box that when displayed is centered

$newdoc=GUICtrlCreateEdit ("", 5,5,390,390,$ES_AUTOVSCROLL+$WS_VSCROLL)

$filemenu = GUICtrlCreateMenu ("&File")

$fileitem = GUICtrlCreateMenuitem ("&Open",$filemenu)

$saveitem = GUICtrlCreateMenuitem ("&Save",$filemenu)

$exititem = GUICtrlCreateMenuitem ("&Exit",$filemenu)

GUISetState ()

GUICtrlSetData (1,$newdoc,1)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

If $msg = $exititem Then ExitLoop

If $msg = $saveitem Then

$var = FileSaveDialog( "Choose a name.", $MyDocsFolder, "Text files (*.txt)", 3, "*.txt")

$file = FileOpen($var, 1)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWrite($file, $newdoc)

FileClose($file)

EndIf

If $msg = $fileitem Then

$var = FileOpenDialog("Choose a file", $MyDocsFolder, "Text files (*.txt)", 1 + 4, "*.txt")

$file = FileOpen($var, 0)

$newdoc = $file

EndIf

Wend

I'm not sure how to get the FileOpenDialog and FileSaveDialog to work with the GUI Edit. Any suggestions? ^_-;

Share this post


Link to post
Share on other sites



Yeah, I'm pretty oblivious. I'm having a little trouble with my program right now. Currently, I'm working on a basic text editor. I'm not exactly sure it's all possibly, but I'm trying anyway. =/ Anyway, this is what I have.

I'm not sure how to get the FileOpenDialog and FileSaveDialog to work with the GUI Edit. Any suggestions? ^_-;

$text = FileRead($file)
GUICtrlSetData ($newdoc, $text)oÝ÷ Ù«­¢+ØÀÌØíÑáÐôU%
ÑɱI ÀÌØí¹Ý½¤)¥±]É¥Ñ ÀÌØí¥±°ÀÌØíÑáФ

Share this post


Link to post
Share on other sites

$text = FileRead($file)
GUICtrlSetData ($newdoc, $text)oÝ÷ Ù«­¢+ØÀÌØíÑáÐôU%
ÑɱI ÀÌØí¹Ý½¤)¥±]É¥Ñ ÀÌØí¥±°ÀÌØíÑáФ
Saving works now, but whenever I attempt to open a file, I get this error.

ERROR: FileRead() [built-in]called with wrong number of args.

$text = FileRead($file)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Saving works now, but whenever I attempt to open a file, I get this error.

You are using old version 3.1.1 or old beta version.

Instal latest beta (133) or better new release version 3.2.0.1

Edited by Zedna

Share this post


Link to post
Share on other sites

You are using old version 3.1.1 or old beta version.

Instal latest beta (133) or better new release version 3.2.0.1

! It works now. Many thanks. :P

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