Jump to content

button


 Share

Recommended Posts

I have a gui with a few buttons, and i want to know how to make a function that when a buton is pressed it will goto a function this is what i have so far:

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 314, 237,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$destination = @TempDir & "\guipick.gif"
FileInstall("C:\Documents and Settings\Dakota\Desktop\gui\guipick.gif", $destination)
;$Input_1 = GuiCtrlCreateInput("Input1", 10, 170, 280, 20)
;$Label_2 = GuiCtrlCreateLabel("Path and FileName (include extention)", 10, 150, 200, 20)
$Button_3 = GuiCtrlCreateButton("Open Log", 120, 200, 80, 30)
$filec = GuiCtrlCreateButton("Change File", 20, 200, 80, 30)
$Pic_5 = GuiCtrlCreatePic("guipick.gif", 10, 20, 280, 120)
$done = GuiCtrlCreateButton("Done", 220, 200, 70, 30)

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


#Region --- CodeWizard generated code Start ---

;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes, Width=500, Height=130
If Not IsDeclared("sInputBoxAnswer") Then Dim $sInputBoxAnswer
$sInputBoxAnswer = InputBox("gui","Path and file name to log file:",$file," ","500","130","-1","-1")
Select
   Case @Error = 0 ;OK - The string returned is valid
$file = $sInputBoxAnswer
msgbox (0,"debug","file now is" & $file )
   Case @Error = 1 ;The Cancel button was pushed

   Case @Error = 3 ;The InputBox failed to open

EndSelect
#EndRegion --- CodeWizard generated code End ---
Link to comment
Share on other sites

How about

While 1 
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button_3
            <function>
        Case $msg = $filec
            <function>
        Case $msg = $done
            <function>
    EndSelect
WEnd

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators

I answered this question in the last thread, no need to double post. Download Beta, go to the Beta Help File, and look at GUICtrlCreateButton(), it gives an exact example.

Most every question you have will be found in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

How about

While 1 
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button_3
            <function>
        Case $msg = $filec
            <function>
        Case $msg = $done
            <function>
    EndSelect
WEnd
besides what SmOke has done... I gave this same answer earlier ... with the function to be called

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

  • 2 weeks later...

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