Jump to content
Sign in to follow this  
dakota

button

Recommended Posts

dakota

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

Share this post


Link to post
Share on other sites
marfdaman

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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
dakota

Ok ihave it now I looked at some exaples

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
Share on other sites
Geeky

My problem with these buttons is that they only work once :S

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.