_Chris_ Posted May 1, 2007 Share Posted May 1, 2007 (edited) Help! My script is function driven, when i select a button on my form it performs an action e.g. a msgbox. While the message box is displayed i disable the form so it cant be tampered with, if i click the form a few times, then click ok on the message box it should close the message box and re-enable the form and let me press buttons again but it dosent it exits completly!! Any ideas? I have been working on it for like an hour!! Edited May 1, 2007 by _Chris_ Link to comment Share on other sites More sharing options...
Samuelhug Posted May 1, 2007 Share Posted May 1, 2007 If you post your script I might be able to help. Link to comment Share on other sites More sharing options...
_Chris_ Posted May 1, 2007 Author Share Posted May 1, 2007 expandcollapse popup#include <GUIConstants.au3> #include <_MouseHover.au3> Opt("GUIOnEventMode", 1) ;Baiscs of the Form $Form1 = GUICreate("", 758,562 , -1, -1,$WS_CAPTION) $BG= GUICtrlCreatepic(@ScriptDir&"\Files\Images\BG.bmp",0,0,758,562,$SS_Sunken) $ExitL = GUICtrlCreatepic(@ScriptDir&"\Files\Images\Exit.bmp",674,520,33,21) $Primary= GUICtrlCreatepic(@ScriptDir&"\Files\Images\Primary_No.bmp",380,55,270,62) $Launcher = GUICtrlCreatepic(@ScriptDir&"\Files\Images\Launcher_No.bmp",380,163,301,65) $Video = GUICtrlCreatepic(@ScriptDir&"\Files\Images\Video_No.bmp",380,271,232,71) ;Buttons of the form $Input1 = GUICtrlCreatepic(@ScriptDir&"\Files\Images\PTT 0.bmp",280,40,90,94) GUICtrlSetOnEvent($Input1,"_Input1") $Input2 = GUICtrlCreatepic(@ScriptDir&"\Files\Images\PTT 0.bmp",280,150,90,94) GUICtrlSetOnEvent($Input2,"_Input2") $Input3 = GUICtrlCreatepic(@ScriptDir&"\Files\Images\PTT2 0.bmp",280,260,90,94) GUICtrlSetOnEvent($Input3,"_Input3") $Xit = GUICtrlCreatepic(@ScriptDir&"\Files\Images\Exit 0.bmp",660,460,62,60) GUICtrlSetOnEvent($Xit,"_Exit") ;Show form after drawing controls Call("_Check") GUISetState(@SW_SHOW) AdlibEnable("_ProcessHover", 50) _HoverAddCtrl($Input1) _HoverAddCtrl($Input2) _HoverAddCtrl($Input3) _HoverAddCtrl($xit) While 1 Wend Func _HoverFound($ControlID) Select Case $ControlID = $Input1 OR $ControlID = $Input2 GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\PTT 1.bmp" ) Case $ControlID = $Input3 GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\PTT2 1.bmp" ) Case $ControlID = $xit GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\Exit 1.bmp" ) EndSelect EndFunc Func _HoverLost($ControlID) Select Case $ControlID = $Input1 OR $ControlID = $Input2 GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\PTT 0.bmp" ) Case $ControlID = $Input3 GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\PTT2 0.bmp" ) Case $ControlID = $xit GUICtrlSetImage ( $ControlID, @ScriptDir&"\Files\Images\Exit 0.bmp" ) EndSelect EndFunc Func _ProcessHover() $ControlID = _HoverCheck() If IsArray($ControlID) Then If $ControlID[0] = "AcquiredHover" Then _HoverFound($ControlID[1]) Else _HoverLost($ControlID[1]) EndIf EndIf EndFunc Func _FileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES) EndFunc Func _Input1() GUISetState(@SW_DISABLE) if FileExists("Q:\Applications\Primary Target Tracker 11.3\Primary Target Tracker 11.3.MSI")Then MsgBox(0x40,"Installed","'Primary Target Tracker 11.3' package already exists on Q:\Aplications") Else DirCreate("Q:\Applications\Primary Target Tracker 11.3") _FileCopy(@ScriptDir & "\Files\Primary Target Tracker 11.3","Q:\Applications") Call("_Check") Endif GUISetState(@SW_ENABLE) Endfunc Func _Input2() GUISetState(@SW_DISABLE) if FileExists("Q:\Applications\Target Tracker Launcher\Target Tracker Launcher.MSI")Then MsgBox(0x40,"Installed","'Target Tracker Launcher' package already exists on Q:\Aplications") Else DirCreate("Q:\Applications\Target Tracker Launcher") _FileCopy(@ScriptDir & "\Files\Target Tracker Launcher","Q:\Applications") Call("_Check") Endif GUISetState(@SW_ENABLE) Endfunc Func _Input3() GUISetState(@SW_DISABLE) if fileexists("Q:\Applications\Primary Target Tracker 11.3 Video Tutorials\Primary Target Tracker 11.3 Video Tutorials.MSI") Then MsgBox(0x40,"Installed","'Primary Target Tracker 11.3 Video Tutorials' package already exists on Q:\Aplications") Else DirCreate("Q:\Applications\Primary Target Tracker 11.3 Video Tutorials") _FileCopy(@ScriptDir & "\Files\Primary Target Tracker 11.3 Video Tutorials","Q:\Applications") Endif GUISetState(@SW_ENABLE) Endfunc Func _Exit() Exit Endfunc Func _Check() if fileexists("Q:\Applications\Primary Target Tracker 11.3\Primary Target Tracker 11.3.MSI") Then GUICtrlSetImage($Primary,@ScriptDir&"\Files\Images\Primary_Yes.bmp") Else GUICtrlSetImage($Primary,@ScriptDir&"\Files\Images\Primary_No.bmp") EndIf if fileexists("Q:\Applications\Target Tracker Launcher\Target Tracker Launcher.MSI") Then GUICtrlSetImage($Launcher,@ScriptDir&"\Files\Images\Launcher_Yes.bmp") Else GUICtrlSetImage($Launcher,@ScriptDir&"\Files\Images\Launcher_No.bmp") EndIf if fileexists("Q:\Applications\Primary Target Tracker 11.3 Video Tutorials\Primary Target Tracker 11.3 Video Tutorials.MSI") Then GUICtrlSetImage($Video,@ScriptDir&"\Files\Images\Video_Yes.bmp") Else GUICtrlSetImage($Video,@ScriptDir&"\Files\Images\Video_No.bmp") Endif EndFunc Its very messy but you should hopefully see what i am getting at. Thanks Link to comment Share on other sites More sharing options...
Kogmedia Posted May 1, 2007 Share Posted May 1, 2007 You could try the code to see where its pausing Opt("TrayIconDebug",1) [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 after getting some immages and setting this up to work, i dont see the problem still... i see 3 buttons and 1 in the bottom right which exits the program... Where exactly are you having problem? (can you maybe submit the images you are using? i just used a picture of an x for all of them to get thier locations) Link to comment Share on other sites More sharing options...
_Chris_ Posted May 2, 2007 Author Share Posted May 2, 2007 Try running the functions and after the function is finished it will exit instead of returning to the form! Iam sure i am just missing something here. Link to comment Share on other sites More sharing options...
smashly Posted May 2, 2007 Share Posted May 2, 2007 (edited) It's the mouse hover udf that's giving you probs... Only guessing but I don't think the MouseHover udf supports OnEventMode 1, if it does then it doesn't work the way your using it.. I notice that most the posts and examples in the MouseHover thread are not OnEventMode 1 , they are using Select case or Switch case in a while loop to register a control being clicked. I could be wrong about this, but I know it's definately the mouse hover function that's causing your script to exit when a function finishes. Cheers. Edited May 2, 2007 by smashly Link to comment Share on other sites More sharing options...
_Chris_ Posted May 2, 2007 Author Share Posted May 2, 2007 Thanks for your help, much apreciated. I had my doubts about the hover over code. Interestingly enough if i take away the form enable/disable code it dosent do it?!? BUT if you click the form when it is disabled it then exits after the function is run! Link to comment Share on other sites More sharing options...
smashly Posted May 2, 2007 Share Posted May 2, 2007 (edited) Your welcome. Appears GuiCtrlSetState works , maybe the long and bloated way around the prob would be to use eg: GuiCtrlSetState($Input_1, $GUI_DISABLE) and GuiCtrlSetState($Input_1, $GUI_ENABLE). But you'd have to do that for all controls in each function , Maybe make 2 new functions 1 function to disable all controls, and the other to enable all controls and call the new functions as needed.. Food for thought. Cheers. Edited May 2, 2007 by smashly 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