J0ker Posted April 23, 2007 Posted April 23, 2007 (edited) Hi,In my gui I have two cases that use the Guigetcursorinfo parameter. One is related when the user right click on a certain picture and the other one happen when the user has his cursor over a picture. The problem that I encounter is that those two Guigetcursorinfo are in conflict. I setted it so when I right click on a picture, it make it blank. It was working fine alone until I added another function using the Guigetcursorinfo. I now have to click 2-3 time before the image become blank ( because I think it make 2 checks with Guigetcursorinfo). How can I correct this problem?SEE ATTACHED FILEexpandcollapse popup#include <GuiConstants.au3> GuiCreate("", 200, 350,-1, -1) $Blank = @ScriptDir & "\Images\blank.bmp" $Blue = @ScriptDir & "\Images\blue.bmp" $File1 = @ScriptDir & "\Images\blank.bmp" $label_1 = GUICtrlCreateLabel("Mouse over buttons", 55, 30) $Picture_0 = GuiCtrlCreatePic($Blank, 30, 55, 35, 35) $Picture_1 = GuiCtrlCreatePic($Blank, 70, 55, 35, 35) $Picture_2 = GuiCtrlCreatePic($Blank, 110, 55, 35, 35) $label_2 = GUICtrlCreateLabel("Right click to set the picture blank", 30, 135) $Picture_3 = GuiCtrlCreatePic($Blank, 60, 160, 35, 35) $Picture_4 = GuiCtrlCreatePic($Blank, 97, 160, 35, 35) $Picture_5 = GuiCtrlCreatePic($Blank, 60, 197, 35, 35) $Picture_6 = GuiCtrlCreatePic($Blank, 97, 197, 35, 35) $Button_1 = GuiCtrlCreateButton("", 79, 300, 35, 35, $BS_BITMAP) GUICtrlSetImage($Button_1, $Blue) $label_3 = GUICtrlCreateLabel("Click to set the picture blue", 30, 280) GuiSetState() While 1 $msg = GuiGetMsg() For $a = 0 to 2 $GuiCursor = GUIGetCursorInfo() If $GuiCursor[4] = Eval('Picture_' & $a) Then If $GuiCursor[4] = 4 Then GuiCtrlSetImage($Picture_0, $Blue) GuiCtrlSetImage($Picture_1, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 5 Then GuiCtrlSetImage($Picture_1, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 6 Then GuiCtrlSetImage($Picture_2, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_1, $Blank) EndIf EndIf Next Select Case $msg = $GUI_EVENT_SECONDARYDOWN $GuiCursor = GUIGetCursorInfo() ;Set the square blank on right click For $a = 3 to 6 If $GuiCursor[4] = Eval('Picture_' & $a) Then GUICtrlSetImage($GuiCursor[4],$Blank) Else EndIf Next Case $msg = $Button_1 $File1 = @ScriptDir & "\Images\blue.bmp" Case $msg = $Picture_3 GUICtrlSetImage($Picture_3,$File1) Case $msg = $Picture_4 GUICtrlSetImage($Picture_4,$File1) Case $msg = $Picture_5 GUICtrlSetImage($Picture_5,$File1) Case $msg = $Picture_6 GUICtrlSetImage($Picture_6,$File1) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd ExitGuiGetCursor_Info_Error.rar Edited April 24, 2007 by J0ker
J0ker Posted April 23, 2007 Author Posted April 23, 2007 (edited) Ok I found out that I add to put every GuiGetCursorInfo on a restriction case (If or Case). That corrected the first problem. If $blabla = 0, everything work fine (except the mouse over) Now, If $blabla = 1 then the "right click" case doesnt work anymore ! Whenever the "mouse over" statement is called, every other things in my Gui (buttons,radios,etc..) stop working. Why? Edited April 23, 2007 by J0ker
Valuater Posted April 23, 2007 Posted April 23, 2007 (edited) i see you using "for" twice but only one "next" this should error-out in SciTE 8) Edited April 23, 2007 by Valuater
J0ker Posted April 23, 2007 Author Posted April 23, 2007 (edited) You certainly caught me when I was editing I removed the first Next, because it wasnt doing anything. I think that error came from the fact that the While loop stop everytime and the $Blabla = 1 and he skip every other cases. I would have to find a working $msg = instead of $Blabla = 1. Please I need help! Edited April 23, 2007 by J0ker
Valuater Posted April 23, 2007 Posted April 23, 2007 (edited) .... this just can't be rightGUICtrlSetImage($GuiCursor[4],$Blank)EDIT: Sorry, that "can" workI have already made _ControlHover(), ButtonHover() and EzSkin 1-2-3any of these should helpI have no intentions of re-inventing the wheel with your style8) Edited April 23, 2007 by Valuater
J0ker Posted April 23, 2007 Author Posted April 23, 2007 (edited) GUICtrlSetImage($GuiCursor[4],$Blank) This work fine! I will try to make a working script, to show you what happen. Edited April 23, 2007 by J0ker
J0ker Posted April 24, 2007 Author Posted April 24, 2007 (edited) OK I made a script to show exactly what happen in my real script:SEE ATTACHED FILE expandcollapse popup#include <GuiConstants.au3> GuiCreate("", 200, 350,-1, -1) $Blank = @ScriptDir & "\Images\blank.bmp" $Blue = @ScriptDir & "\Images\blue.bmp" $File1 = @ScriptDir & "\Images\blank.bmp" $label_1 = GUICtrlCreateLabel("Mouse over buttons", 55, 30) $Picture_0 = GuiCtrlCreatePic($Blank, 30, 55, 35, 35) $Picture_1 = GuiCtrlCreatePic($Blank, 70, 55, 35, 35) $Picture_2 = GuiCtrlCreatePic($Blank, 110, 55, 35, 35) $label_2 = GUICtrlCreateLabel("Right click to set the picture blank", 30, 135) $Picture_3 = GuiCtrlCreatePic($Blank, 60, 160, 35, 35) $Picture_4 = GuiCtrlCreatePic($Blank, 97, 160, 35, 35) $Picture_5 = GuiCtrlCreatePic($Blank, 60, 197, 35, 35) $Picture_6 = GuiCtrlCreatePic($Blank, 97, 197, 35, 35) $Button_1 = GuiCtrlCreateButton("", 79, 300, 35, 35, $BS_BITMAP) GUICtrlSetImage($Button_1, $Blue) $label_3 = GUICtrlCreateLabel("Click to set the picture blue", 30, 280) GuiSetState() While 1 $msg = GuiGetMsg() For $a = 0 to 2 $GuiCursor = GUIGetCursorInfo() If $GuiCursor[4] = Eval('Picture_' & $a) Then If $GuiCursor[4] = 4 Then GuiCtrlSetImage($Picture_0, $Blue) GuiCtrlSetImage($Picture_1, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 5 Then GuiCtrlSetImage($Picture_1, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 6 Then GuiCtrlSetImage($Picture_2, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_1, $Blank) EndIf EndIf Next Select Case $msg = $GUI_EVENT_SECONDARYDOWN $GuiCursor = GUIGetCursorInfo() ;Set the square blank on right click For $a = 3 to 6 If $GuiCursor[4] = Eval('Picture_' & $a) Then GUICtrlSetImage($GuiCursor[4],$Blank) Else EndIf Next Case $msg = $Button_1 $File1 = @ScriptDir & "\Images\blue.bmp" Case $msg = $Picture_3 GUICtrlSetImage($Picture_3,$File1) Case $msg = $Picture_4 GUICtrlSetImage($Picture_4,$File1) Case $msg = $Picture_5 GUICtrlSetImage($Picture_5,$File1) Case $msg = $Picture_6 GUICtrlSetImage($Picture_6,$File1) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit oÝ÷ Ù¦¢÷+)j»h~Ø^±Êâ¦Ûh±ç¡£az¸ ×%É0¢¹¢ºÞrÙrjëh×6 For $a = 0 to 2 $GuiCursor = GUIGetCursorInfo() If $GuiCursor[4] = Eval('Picture_' & $a) Then If $GuiCursor[4] = 4 Then GuiCtrlSetImage($Picture_0, $Blue) GuiCtrlSetImage($Picture_1, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 5 Then GuiCtrlSetImage($Picture_1, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_2, $Blank) ElseIf $GuiCursor[4] = 6 Then GuiCtrlSetImage($Picture_2, $Blue) GuiCtrlSetImage($Picture_0, $Blank) GuiCtrlSetImage($Picture_1, $Blank) EndIf EndIf NextAs you can see, when there are 2 GuiGetCursorInfo, they are in conflict. In GuiGetCursorInfo ERROR.au3, it take 2-3 right clicks to delete (set blank) correctly the picture. However, when there are only 1 GuiGetCursorInfo, it take 1 right click to delete the picture. Anyone can help me solve this problem?GuiGetCursor_Info_Error.rar Edited April 24, 2007 by J0ker
Valuater Posted April 24, 2007 Posted April 24, 2007 just change the pic and it shows... interesting effect this works ???? dunno why 8)
J0ker Posted April 24, 2007 Author Posted April 24, 2007 (edited) The file you uploaded doesnt work correctly on right click. It take 3-4 clicks to change the picture to red correctly. I have the same problem in my script. Edited April 24, 2007 by J0ker
upnorth Posted April 24, 2007 Posted April 24, 2007 untested While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 $File1 = @ScriptDir & '\Images\blue.bmp' Case $Picture_3, $Picture_4, $Picture_5, $Picture_6 GUICtrlSetImage( $msg, $File1) EndSwitch $GuiCursor = GUIGetCursorInfo() Switch $GuiCursor[4] Case $Picture_0, $Picture_1, $Picture_2 GuiCtrlSetImage( $GuiCursor[4], $Blue) For $i = 0 To 2 If Eval( 'Picture_' & $i) <> $GuiCursor[4] Then GuiCtrlSetImage( Eval( 'Picture_' & $i), $Blank) EndIf Next Case $Picture_3, $Picture_4, $Picture_5, $Picture_6 If $GuiCursor[3] Then GUICtrlSetImage( $GuiCursor[4], $Blank) EndIf EndSwitch WEnd Exit
J0ker Posted April 25, 2007 Author Posted April 25, 2007 (edited) Wow, THANKS ALOT !!!!!!!!!!!!!! I thought that I will never correct this problem but you did! Seriously, God bless you ! Edited April 25, 2007 by J0ker
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