JellyFish666 Posted June 10, 2008 Share Posted June 10, 2008 (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 June 10, 2008 by JellyFish666 Link to comment Share on other sites More sharing options...
DaRam Posted June 10, 2008 Share Posted June 10, 2008 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(). Link to comment Share on other sites More sharing options...
evilertoaster Posted June 10, 2008 Share Posted June 10, 2008 button with image- #include <GUIConstants.au3> GUICreate("test") GUICtrlCreateButton("button",10,10,200,200,$BS_BITMAP) GUICtrlSetImage(-1,@ScriptDir&"\pic.bmp") GUISetState() while 1 Sleep(100) WEnd Link to comment Share on other sites More sharing options...
cartman380 Posted June 10, 2008 Share Posted June 10, 2008 (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 June 10, 2008 by cartman380 Link to comment Share on other sites More sharing options...
DaRam Posted June 10, 2008 Share Posted June 10, 2008 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 Link to comment Share on other sites More sharing options...
JellyFish666 Posted June 10, 2008 Author Share Posted June 10, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now