Sign in to follow this  
Followers 0
JellyFish666

Problem with GUI

6 posts in this topic

#1 ·  Posted (edited)

I am not sure why this isn't working... and also I can't set a image for a button is this because of changes made to Autoit or am I forgetting something.

when I click the image it should give me a message box...

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $SS_REALSIZEIMAGE , $SS_NOTIFY
$GUI = GUICreate("Form1", 200, 200)
$Pic = GUICtrlCreatePic(@ScriptDir & "\Sprites\Attack_0.jpg", 0, 0, 100, 50, $SS_NOTIFY + $SS_REALSIZEIMAGE)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic
            MsgBox(0 , "" , "test")

    EndSwitch
WEnd
Edited by JellyFish666

Share this post


Link to post
Share on other sites



Why are you declaring Global $SS_REALSIZEIMAGE , $SS_NOTIFY ?

If you do plan to use it you do have to set it's value to something for it to be usefull in GuiCreatePic().

:)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I got it to work using the following code

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate("Form1", 200, 200)
$Pic = GUICtrlCreatePic(@ScriptDir & "\my.jpg", 0, 0, 100, 50)

GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic
            MsgBox(0 , "" , "test")
    EndSwitch
WEnd
Edited by cartman380

Share this post


Link to post
Share on other sites

Interesting, the error loading the (non-existent picture file) caused a $Pic event, so an endless $pic event + msg until a Tray Click forced exit!

This should let you know what's going on.....

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $SS_REALSIZEIMAGE , $SS_NOTIFY ; <= In some other include, search for it !
$GUI = GUICreate("Form1", 200, 200)
$Pic = GUICtrlCreatePic(@ScriptDir & "\Sprites\Attack_0.jpg", 0, 0, 100, 50, $SS_NOTIFY + $SS_REALSIZEIMAGE)
If @error Then
   MsgBox(64, "Error" , "Could NOT Load Picture !")
   $Pic = GUICtrlCreatePic("", 0, 0, 100, 50, $SS_NOTIFY + $SS_REALSIZEIMAGE)
EndIf
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic
            MsgBox(0 , "" , "test")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Why are you declaring Global $SS_REALSIZEIMAGE , $SS_NOTIFY ?

If you do plan to use it you do have to set it's value to something for it to be usefull in GuiCreatePic().

:)

It gave me a error without having that so thats why I added it.

Thanks for everyones help, I am not on my computer till tomorrow so can't really test it but sure it should work, thanks again.

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