Sign in to follow this  
Followers 0
vikingnor

Button Problems

9 posts in this topic

here is the source

uiCreate("Chronos Tool", 287, 256,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Server 1", 10, 180, 130, 30)
$Button_2 = GuiCtrlCreateButton("Server 2", 150, 180, 130, 30)
$Input_3 = GuiCtrlCreateInput("text", 20, 100, 250, 70)
$Button_4 = GuiCtrlCreateButton("Update Addons", 10, 60, 120, 30)
$Button_5 = GuiCtrlCreateButton("Go to Forum", 160, 60, 120, 30)
$Button_6 = GuiCtrlCreateButton("Irc Chat", 10, 20, 120, 30)
$Button_7 = GuiCtrlCreateButton("About", 160, 20, 120, 30)
$Button_8 = GuiCtrlCreateButton("Exit", 80, 220, 130, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_1
Case $msg = $Button_2
Case $msg = $Button_8
    ExitLoop
    
EndSelect

is it any way to make things do actions when i click on the buttons?

Share this post


Link to post
Share on other sites



GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

Func CLOSEClicked()
 ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
 ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow
  If @GUI_WINHANDLE = $mainwindow Then 
    MsgBox(0, "GUI Event", "You clicked CLOSE in the main window! Exiting...")
    Exit
  EndIf 
EndFunc


Thanks in advance

Share this post


Link to post
Share on other sites

this works for me

Opt("GUIOnEventMode", 1)

$start=GUICtrlCreateButton("start", 100, 270, 60)

GUICtrlSetOnEvent($start, "StartPressed")

func StartPressed()

Endfunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Here an example:

#include <GuiConstants.au3>

Opt("GuiOnEventMode", 1)

GUICreate("Chronos Tool", 287, 256,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close")

$Button_1 = GuiCtrlCreateButton("Server 1", 10, 180, 130, 30)
GUICtrlSetOnEvent(-1, "Do_Something1")
$Button_2 = GuiCtrlCreateButton("Server 2", 150, 180, 130, 30)
GUICtrlSetOnEvent(-1, "Do_Something2")
$Input_3 = GuiCtrlCreateInput("text", 20, 100, 250, 70)
$Button_4 = GuiCtrlCreateButton("Update Addons", 10, 60, 120, 30)
GUICtrlSetOnEvent(-1, "Do_Something3")
$Button_5 = GuiCtrlCreateButton("Go to Forum", 160, 60, 120, 30)
$Button_6 = GuiCtrlCreateButton("Irc Chat", 10, 20, 120, 30)
$Button_7 = GuiCtrlCreateButton("About", 160, 20, 120, 30)
$Button_8 = GuiCtrlCreateButton("Exit", 80, 220, 130, 30)
GUICtrlSetOnEvent(-1, "GUI_Close")

GuiSetState()

While 1
   Sleep(100)
WEnd

Func Do_Something1()
    MsgBox(0, "", "You clicked button_1")
EndFunc

Func Do_Something2()
    MsgBox(0, "", "You clicked button_2")
EndFunc

Func Do_Something3()
    MsgBox(0, "", "You clicked button_4")
EndFunc

Func GUI_Close()
    Exit
EndFunc
Edited by big_daddy

Share this post


Link to post
Share on other sites

i have an other problem with the button thing,

everything works fine for me but if i use

the Opt("GUIOnEventMode", 1) thing i can not close the gui like other programms with (x) close

does anyone know?

thanks

Share this post


Link to post
Share on other sites

anyone know how to make links on the buttons? to etc browsers.

btw ty for help :think:

Share this post


Link to post
Share on other sites

i have an other problem with the button thing,

everything works fine for me but if i use

the Opt("GUIOnEventMode", 1) thing i can not close the gui like other programms with (x) close

does anyone know?

thanks

You have to tell it what to do when you use GUIOnEventMode.

Opt("GuiOnEventMode", 1)

GUICreate("Test GUI")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close")

Func GUI_Close()
    Exit
EndFunc  ;==>GUI_Close

Share this post


Link to post
Share on other sites

anyone know how to make links on the buttons? to etc browsers.

btw ty for help :think:

First you need to get the IE.au3 UDF. Then look at the examples in post 3 of the same page.

Share this post


Link to post
Share on other sites

You have to tell it what to do when you use GUIOnEventMode.

Opt("GuiOnEventMode", 1)

GUICreate("Test GUI")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close")

Func GUI_Close()
    Exit
EndFunc ;==>GUI_Close

great it works, thanks a lot

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