GoldenEye Posted March 10, 2013 Share Posted March 10, 2013 (edited) Hello there!First of all, thank you for your time n' support.This is my first post and I hope this isn't an inconvenient.Well, my problem is that I'm a noob noob noob in AutoIt, and I wanna make a GUI with two PNGs images as buttons, then i need to run an exe when I click under the buttons, I think I'm not far from my objective...The function of my PNGs buttons works in 3 steps, 1 normal mode non focused, 2 focused, 3 clicked...I used "GUIGetCursorInfo()" and "IsArray" for detect the mouse pointer over my png.If I only use one button, all its good, but if I use two or more buttons sometimes the PNGs are flashing at the GUI.I was reading for many days for make this code.I'm a beginner and i don't understand as easy as it looks.Sorry for my bad English, I'm Mexican. I hope you could help me!Thank you guys!expandcollapse popup#Include <GUIConstantsEx.au3> #Include <WindowsConstants.au3> #Include "GUICtrlPic.au3" #Region ### START GUI Background ### GUICreate( "NXT-System" , @DesktopWidth , @DesktopHeight , 0 , 0 , $WS_POPUP ) GUISetBkColor( 0xffffff ) GUICtrlCreatePic( @ScriptDir & "\Media\bg_01.jpg" , 0 , 0 , @DesktopWidth , @DesktopHeight ) GUICtrlSetState( -1 , $GUI_DISABLE ) GUISetState( @SW_SHOW ) #EndRegion ### END GUI Background ### #Region ### START GUI Items ### $FlashLt = ObjCreate( "ShockwaveFlash.ShockwaveFlash" ) $FlashLtCtrl = GUICtrlCreateObj( $FlashLt , @DesktopWidth/2 -100 , @DesktopHeight/2 +30 , 112 , 80 ) $FlashLt.Movie = @ScriptDir & "\Media\f_izq.swf" $FlashLt.Menu = False $FlashLt.Play $FlashLt.wmode = "transparent" $FlashRt = ObjCreate( "ShockwaveFlash.ShockwaveFlash" ) $FlashRtCtrl = GUICtrlCreateObj( $FlashRt , @DesktopWidth/2 +50 , @DesktopHeight/2 +30 , 112 , 80 ) $FlashRt.Movie = @ScriptDir & "\Media\f_der.swf" $FlashRt.Menu = False $FlashRt.Play $FlashRt.wmode = "transparent" GUISetState() $PNGLt = @ScriptDir & "\Media\m_izq.png" $PNGLtCtrl = _GUICtrlPic_Create( $PNGLt , @DesktopWidth/2 -550 , @DesktopHeight/2 -200 , 300 , 300 ) $PNGRt = @ScriptDir & "\Media\m_der.png" $PNGRtCtrl = _GUICtrlPic_Create( $PNGRt , @DesktopWidth/2 +250 , @DesktopHeight/2 -200 , 300 , 300 ) GUISetState( @SW_SHOW ) Dim $GO = False #EndRegion ### END GUI Items ### #Region ### START GUI Function ### ;~ My problem start here :( -------------------------------------------------------------- While 1 $ReadMouse = GUIGetCursorInfo() If IsArray($ReadMouse) = 1 Then Select Case $ReadMouse[4] = $PNGLtCtrl and $GO = False _GUICtrlPic_SetImage( $PNGLtCtrl , @ScriptDir & "\Media\m_izq_o.png" , 0 ) $GO = True Case $ReadMouse[4] <> $PNGLtCtrl and $GO = True _GUICtrlPic_SetImage( $PNGLtCtrl , @ScriptDir & "\Media\m_izq.png" , 0 ) $GO = False EndSelect EndIf If IsArray($ReadMouse) = 1 Then Select Case $ReadMouse[4] = $PNGRtCtrl and $GO = False _GUICtrlPic_SetImage( $PNGRtCtrl , @ScriptDir & "\Media\m_der_o.png" , 0 ) $GO = True Case $ReadMouse[4] <> $PNGRtCtrl and $GO = True _GUICtrlPic_SetImage( $PNGRtCtrl , @ScriptDir & "\Media\m_der.png" , 0 ) $GO = False EndSelect EndIf Switch GUIGetMsg() Case -3 Exit Case $PNGLtCtrl _GUICtrlPic_SetImage( $PNGLtCtrl , @ScriptDir & "\Media\m_izq_p.png" , 0 ) MsgBox( 0 , "" , "Pressed" ) ;after all here will be the run instruction for Run("exe1") _GUICtrlPic_SetImage( $PNGLtCtrl , @ScriptDir & "\Media\m_izq.png" , 0 ) EndSwitch Switch GUIGetMsg() Case $PNGRtCtrl _GUICtrlPic_SetImage( $PNGRtCtrl , @ScriptDir & "\Media\m_der_p.png" , 0 ) MsgBox( 0 , "" , "Pressed" ) ;after all here will be the run instruction for Run("exe2") _GUICtrlPic_SetImage( $PNGRtCtrl , @ScriptDir & "\Media\m_der.png" , 0 ) EndSwitch WEnd ;--------------------------------------------------------------------------------------------- #EndRegion ### END GUI Function ###Edit:PS. For the PNGs I used "GuiCtrlPic.au3" for an easier code... "@Grossvater has a UDF named GuiCtrlPic.au3 on AutoIt.de"This is a screenshot of my problem:http://imageshack.us/f/259/sinttulo1zd.jpg/Thanks Edited March 10, 2013 by GoldenEye Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 10, 2013 Share Posted March 10, 2013 search for setting the image using GDI+ that may help Regards GoldenEye 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. 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