Jump to content

Buttons Closing GUI


obone
 Share

Recommended Posts

I do not want my Buttons to close the gui. I want the gui to stay up when it activates an activity?

#include <GuiConstants.au3>

; Hides tray icon

Global Const $SS_CENTER=1

#NoTrayIcon

; Change to OnEvent mode

Opt('GUIOnEventMode', 1)

; GUI Creation

Creategui()

Func Creategui()

Local $font

$font = "Comic Sans MS"

GuiCreate("ALT Fabrication Toolbox", 700, 700)

GUISetBkColor(0x191970)

GuiSetIcon("icon.ico")

GUICtrlCreateLabel("HOUSTON",180,28,500,180)

GUICtrlSetColor(-1,0xff8c00)

GUIctrlsetFont(-1,75,600,$font)

; Runs the GUIExit() function if the GUI is closed

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

; Logo / Pic

GuiCtrlCreatePic("altlogo.gif",0,0,177,178)

; Instructions

; Button1

GUICtrlCreateButton("Store Locations", 10, 180, 200, 30)

GUICtrlSetOnEvent(-1,'website' ) ; Runs website() when pressed

; Button2

GUICtrlCreateButton("Contacts", 10, 220, 200, 30)

GUICtrlSetOnEvent(-1, 'email') ; Runs email() when pressed

GUICtrlCreateButton("ALT Website",10,260,200,30)

GUICtrlSetOnEvent(-1,'website1')

EndFunc

Func website()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.test.com")

Exit

EndFunc

Func email()

; Hides the GUI while the function is running

GUISetState()

Run("mailto:ben@hitesales.com")

Exit

EndFunc

func website1()

GUISetState()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.afraidyet.net/forums/misc.php?do=page&template=Darkfall_Map")

Exit

EndFunc

; Shows the GUI after the function completes

GUISetState()

While 1

Sleep(500)

WEnd

; This function makes the script exit when the GUI is closed

Func GUIExit()

Exit

EndFunc

Link to comment
Share on other sites

Maybe...

#include <GuiConstants.au3>
; Hides tray icon
#NoTrayIcon

; Change to OnEvent mode
Opt('GUIOnEventMode', 1)

Global Const $SS_CENTER = 1

; GUI Creation

Creategui()

; Shows the GUI after the function completes
GUISetState()

While 1
    Sleep(500)
WEnd

; --------------- FUNCTIONS ---------------------

Func Creategui()
    Local $font

    $font = "Comic Sans MS"
    GUICreate("ALT Fabrication Toolbox", 700, 700)
    GUISetBkColor(0x191970)
    GUISetIcon("icon.ico")


    GUICtrlCreateLabel("HOUSTON", 180, 28, 500, 180)
    GUICtrlSetColor(-1, 0xff8c00)
    GUICtrlSetFont(-1, 75, 600, $font)

    ; Runs the GUIExit() function if the GUI is closed
    GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')
    ; Logo / Pic
    GUICtrlCreatePic("altlogo.gif", 0, 0, 177, 178)
    ; Instructions

    ; Button1
    GUICtrlCreateButton("Store Locations", 10, 180, 200, 30)
    GUICtrlSetOnEvent(-1, 'website') ; Runs website() when pressed
    ; Button2
    GUICtrlCreateButton("Contacts", 10, 220, 200, 30)
    GUICtrlSetOnEvent(-1, 'email') ; Runs email() when pressed

    GUICtrlCreateButton("ALT Website", 10, 260, 200, 30)
    GUICtrlSetOnEvent(-1, 'website1')
EndFunc   ;==>Creategui

Func website()
    Run("C:\Program Files\Internet Explorer\iexplore.exe www.test.com")
EndFunc   ;==>website

Func email()
    Run("mailto:ben@hitesales.com")
EndFunc   ;==>email

Func website1()
    Run("C:\Program Files\Internet Explorer\iexplore.exe www.afraidyet.net/forums/misc.php?do=page&template=Darkfall_Map")

EndFunc   ;==>website1

; This function makes the script exit when the GUI is closed
Func GUIExit()
    Exit
EndFunc   ;==>GUIExit

8)

NEWHeader1.png

Link to comment
Share on other sites

For some reason I cannot click on my buttons anymore. It think that it has something to do with the JPG being in the background behind my buttons.. I remove it and they work... Any thing that you guys can think of?

Thanks again.

Obone

CODE
#include <GuiConstants.au3>

; Hides tray icon

#NoTrayIcon

; Change to OnEvent mode

Opt('GUIOnEventMode', 1)

Global Const $SS_CENTER = 1

; GUI Creation

Creategui()

; Shows the GUI after the function completes

GUISetState()

While 1

Sleep(500)

WEnd

; --------------- FUNCTIONS ---------------------

Func Creategui()

Local $font

$font = "Comic Sans MS"

GUICreate("ALT Fabrication Toolbox", 700, 700)

GUISetBkColor(0x191970)

GUISetIcon("icon.ico")

GUICtrlCreateLabel("HOUSTON", 180, 28, 500, 180)

GUICtrlSetColor(-1, 0xff8c00)

GUICtrlSetFont(-1, 75, 600, $font)

; Runs the GUIExit() function if the GUI is closed

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

; Logo / Pic

GuiCtrlCreatePic("altlogo2.jpg",0,0,700,590)

; Instructions

; Button1

GUICtrlCreateButton("Store Locations", 10, 180, 200, 30)

GUICtrlSetOnEvent(-1, 'website') ; Runs website() when pressed

; Button2

GUICtrlCreateButton("Contacts", 10, 220, 200, 30)

GUICtrlSetOnEvent(-1, 'email') ; Runs email() when pressed

GUICtrlCreateButton("ALT Website", 10, 260, 200, 30)

GUICtrlSetOnEvent(-1, 'website1')

EndFunc ;==>Creategui

Func website()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.test.com")

EndFunc ;==>website

Func email()

Run("mailto:ben@hitesales.com")

EndFunc ;==>email

Func website1()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.afraidyet.net/forums/misc.php?do=page&template=Darkfall_Map")

EndFunc ;==>website1

; This function makes the script exit when the GUI is closed

Func GUIExit()

Exit

EndFunc ;==>GUIExit

Link to comment
Share on other sites

For some reason I cannot click on my buttons anymore. It think that it has something to do with the JPG being in the background behind my buttons.. I remove it and they work... Any thing that you guys can think of?

Thanks again.

Obone

CODE
#include <GuiConstants.au3>

; Hides tray icon

#NoTrayIcon

; Change to OnEvent mode

Opt('GUIOnEventMode', 1)

Global Const $SS_CENTER = 1

; GUI Creation

Creategui()

; Shows the GUI after the function completes

GUISetState()

While 1

Sleep(500)

WEnd

; --------------- FUNCTIONS ---------------------

Func Creategui()

Local $font

$font = "Comic Sans MS"

GUICreate("ALT Fabrication Toolbox", 700, 700)

GUISetBkColor(0x191970)

GUISetIcon("icon.ico")

GUICtrlCreateLabel("HOUSTON", 180, 28, 500, 180)

GUICtrlSetColor(-1, 0xff8c00)

GUICtrlSetFont(-1, 75, 600, $font)

; Runs the GUIExit() function if the GUI is closed

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

; Logo / Pic

GuiCtrlCreatePic("altlogo2.jpg",0,0,700,590)

; Instructions

; Button1

GUICtrlCreateButton("Store Locations", 10, 180, 200, 30)

GUICtrlSetOnEvent(-1, 'website') ; Runs website() when pressed

; Button2

GUICtrlCreateButton("Contacts", 10, 220, 200, 30)

GUICtrlSetOnEvent(-1, 'email') ; Runs email() when pressed

GUICtrlCreateButton("ALT Website", 10, 260, 200, 30)

GUICtrlSetOnEvent(-1, 'website1')

EndFunc ;==>Creategui

Func website()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.test.com")

EndFunc ;==>website

Func email()

Run("mailto:ben@hitesales.com")

EndFunc ;==>email

Func website1()

Run("C:\Program Files\Internet Explorer\iexplore.exe www.afraidyet.net/forums/misc.php?do=page&template=Darkfall_Map")

EndFunc ;==>website1

; This function makes the script exit when the GUI is closed

Func GUIExit()

Exit

EndFunc ;==>GUIExit

You need to disable the Pic or it will 'steal' the clicks.

$Pic = GuiCtrlCreatePic("altlogo2.jpg",0,0,700,590)
$GuiCtrlSetState($Pic,$GUI_DISABLE)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...