Jump to content

GUICtrlCreateEdit,FileOpenDialog,etc


Recommended Posts

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? ^_-;

Link to comment
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 ÀÌØí¹Ý½¤)¥±]É¥Ñ ÀÌØí¥±°ÀÌØíÑáФ
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...