Jump to content

Close On Cancel | Help


Recommended Posts

;***********************
; Sample GUI Menu V2
; Coded by: Dan
; August 2, 2006
;Special Thanks to: gafrost, Paulie, and codemyster!
;***********************

#include <GuiConstants.au3>
#include <Misc.au3>
#include <File.au3>
FileWrite("c:/blank.txt", "")
Global $oRP

$name = InputBox("Log In", "Please enter your name:")

; GUI
GUICreate("Sample GUI Menu V2", 400, 400)
GUISetIcon(@SystemDir & " otepad.exe", 0)
$TagsPageC = GUICtrlCreateLabel('Visit Homepage', 5, 399, 100, 15, $SS_CENTER)
GUICtrlSetFont($TagsPageC, 9, 400, 4)
GUICtrlSetColor($TagsPageC, 0x0000ff)
GUICtrlSetCursor($TagsPageC, 0)

; BANNER
$s_TempFile = _TempFile()
InetGet("http://i37.photobucket.com/albums/e91/Zombie1992/logo4.gif", $s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 67)

; SLIDER
GUICtrlCreateLabel("Slider:", 235, 325)
GUICtrlCreateSlider(270, 325, 120, 30)
GUICtrlSetData(-1, 30)

; TEXT
GUICtrlCreateLabel("This is the text for a Main Menu! This is the text for a Main Menu! This is the text for a Main Menu! This is the text for a Main Menu! This is the text for a Main Menu! This is the text for a Main MenuV2!", 10, 275, 389, 37)
$label = GUICtrlCreateLabel("Logged in as: " & $name, 150, 75, 400, 14)
;GUICtrlSetStyle (-1, $SS_RIGHT )

; MENU
$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuitem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuitem("", $filemenu)
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem = GUICtrlCreateMenuitem("About", $helpmenu)

; TAB
GUICtrlCreateTab(1, 70, 400, 190)
$tab1 = GUICtrlCreateTabItem("Intro")
GUICtrlCreateLabel("Welcome to Sample GUI Menu V2." & @CRLF & " " & @CRLF & "Sample Gui Program Is In Launch. This is a sample gui with features such as login, tabs, clickable links, and NotePad Feature! ", 20, 120, 385, 100)
GUICtrlCreateTabItem("Info")
$Edit_1 = GuiCtrlCreateEdit("Welcome to SimpleEdit 1.1 Created by: codemyster", 15, 100, 373, 120)
$Button_2 = GuiCtrlCreateButton("New", 20, 220, 100, 30)
$Button_3 = GuiCtrlCreateButton("Save", 220, 220, 100, 30)
$Button_7 = GuiCtrlCreateButton("Open", 120, 220, 100, 30)
GUICtrlCreateTabItem("AutoIt")
GUICtrlCreateLabel("AutoIt Created by Jonathan Bennett. www.autoitscript.com " & @CRLF & @CRLF & "Version 2: http://www.autoitscript.com/AutoIt/ " & @CRLF & "" & @CRLF & "Version 3: http://www.autoitscript.com/autoit3/'", 20, 120, 385, 120)
; GUI MESSAGE        LOOP

GUICtrlCreateTabItem("")   ; end tabitem definition
GUICtrlSetState($tab1, $GUI_SHOW)   ; will be display first

GUISetState()

While 1
    $msg = GUIGetMsg()
   
    Select
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuitem($file, $recentfilesmenu)
        Case $msg = $exititem
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
;~    $oRP.SaveFile (@ScriptDir & "RichText.rtf", 0)
            ExitLoop
           
        Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.autoitscript.com/autoit3%27"]http://www.autoitscript.com/autoit3', '', @SW_HIDE)
           
        Case $msg = $aboutitem
            MsgBox(0, "About Sample GUI Menu V2", "Sample GUI Menu V2" & @CRLF & @CRLF & "Created by: Javascript_Freek" & @CRLF & "" & @CRLF & "©AutoIt")
        Case $msg = $GUI_EVENT_CLOSE
                $msg = GuiGetMsg()
        Case $msg = $Button_2
        GUICtrlSetData($Edit_1, "")
        Case $msg = $Button_3
       FileWrite(FilesaveDialog("Select a file to save",@ScriptDir, "All Files (*.*)"),GUICtrlRead($Edit_1))
       Case $msg = $Button_7
       GUICtrlSetData($Edit_1,Fileread(FileOpenDialog("Select a file to open",@ScriptDir, "All Files (*.*)")))
         Exit
    EndSelect
WEnd

Doesn anyknow know why on the open of SimpleEdit 1.1 on the second tab. When I click open. then cancel the whole application closes. Why does that happen?

[center]Cookyx.com :: Simple LAN Chat[/center]

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...