Jump to content

Newbie GUI Buttons


Recommended Posts

OK, I've decided to add a GUI to this project and the first thing I do is add a picture and a CLOSE button. It runs fine, except the CLOSE button won't... I thought the process was to create a button and assign the handle to a variable, then use the Select Case statement inside a While loop to check for $msg = $Btn_Close, but it doesn't work... what am I missing??

Thanks,

gpence

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
GuiCreate("Project Name", 600, 300,(@DesktopWidth-600)/2, (@DesktopHeight-300)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$Pic_1 = GuiCtrlCreatePic("proj_logo.gif", 0, 0, 600, 300)
$Btn_Close = GUICtrlCreateButton ("Close", 500, 240, 90, 35, $BS_CENTER + $BS_DEFPUSHBUTTON + $BS_VCENTER)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
      Case $msg = $GUI_EVENT_CLOSE
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
      Case $msg = $Btn_Close
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Link to comment
Share on other sites

#include <GuiConstants.au3>

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
GuiCreate("Project Name", 600, 300,(@DesktopWidth-600)/2, (@DesktopHeight-300)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$Pic_1 = GuiCtrlCreatePic("proj_logo.gif", 0, 0, 600, 300)
$Btn_Close = GUICtrlCreateButton ("Close", 500, 240, 90, 35, $BS_CENTER + $BS_DEFPUSHBUTTON + $BS_VCENTER)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
      Case $msg = $GUI_EVENT_CLOSE
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
      Case $msg = $Btn_Close
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

jdeb is correct i believe, I didn't have a picture to test with.

if you want the picture to cover the gui.

add your other controls 1st then add picture and disable picture.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

jdeb is correct i believe, I didn't have a picture to test with.

if you want the picture to cover the gui.

add your other controls 1st then add picture and disable picture.

<{POST_SNAPBACK}>

You're both correct. I used a 600x300 image with a white background and a small logo in the upper left corner. Now I understand I've put a control on top of my button so the click never reaches the button, correct?

OK, I see 2 possible courses of action:

a) gafrost's suggestion of disabling the picture -- and a cursory look at help isn't giving me a good example of how to do that, or

B) use the small logo and set the background to white (which again, I need a suggestion on how to do that... sorry)

OK -- I got the GUICtrlSetState to work!! But for future reference, can you tell me how to set the background white (option B)?

Hmm, it worked -- sort of... when the GUI comes up, the button is hidden by the pic until I mouseover it, then it becomes static in the proper place... why?

Thanks,

gpence

Edited by gpence
Link to comment
Share on other sites

sorry try it this way, create your controls and then disable the pic

#include <GuiConstants.au3>

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
GuiCreate("Project Name", 600, 300,(@DesktopWidth-600)/2, (@DesktopHeight-300)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$Pic_1 = GuiCtrlCreatePic("proj_logo.gif", 0, 0, 600, 300)
$Btn_Close = GUICtrlCreateButton ("Close", 500, 240, 90, 35, $BS_CENTER + $BS_DEFPUSHBUTTON + $BS_VCENTER)
GUICtrlSetState($Pic_1,$GUI_DISABLE)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
      Case $msg = $GUI_EVENT_CLOSE
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
      Case $msg = $Btn_Close
        MsgBox(0, " Closing ", "  Exiting the Vault II Transfer Auditor...  ", 2)
        ExitLoop
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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