schliden Posted April 23, 2007 Posted April 23, 2007 Hi, Wondering if there is a way to do the following: I Have an input control that allows entry/selection of a path and a corresponding button that allows selection of same via FileSelectFolder Here is the main While loop While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _End() Case $Input2 ' How do I trigger the block of code below ? Case $Button2 if _Target() Then if $gsFileList <> "" Then if _BuildArray() Then _BuildList() endif GUICtrlSetState($ListView1, $GUI_ENABLE) endif endif EndSwitch WEnd What I would like to do, is trigger the same code that occurs when Case $Button2 when Case $Input2. Of course, I could just repeat the code under Case $Input2, or put the whole lot in a function, but I thought there might be an easier way ? TIA
BrettF Posted April 23, 2007 Posted April 23, 2007 Hi, Wondering if there is a way to do the following: I Have an input control that allows entry/selection of a path and a corresponding button that allows selection of same via FileSelectFolder Here is the main While loop While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _End() Case $Input2 ' How do I trigger the block of code below ? Case $Button2 if _Target() Then if $gsFileList <> "" Then if _BuildArray() Then _BuildList() endif GUICtrlSetState($ListView1, $GUI_ENABLE) endif endif EndSwitch WEnd What I would like to do, is trigger the same code that occurs when Case $Button2 when Case $Input2. Of course, I could just repeat the code under Case $Input2, or put the whole lot in a function, but I thought there might be an easier way ? TIA Try an 'or'... so your code would look like: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _End() Case $Button2 or $Input2 if _Target() Then if $gsFileList <> "" Then if _BuildArray() Then _BuildList() endif GUICtrlSetState($ListView1, $GUI_ENABLE) endif endif EndSwitch WEnd See how that goes Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
schliden Posted April 23, 2007 Author Posted April 23, 2007 Try an 'or'... so your code would look like: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _End() Case $Button2 or $Input2 if _Target() Then if $gsFileList <> "" Then if _BuildArray() Then _BuildList() endif GUICtrlSetState($ListView1, $GUI_ENABLE) endif endif EndSwitch WEnd See how that goes Bert, Of course. Yes that works. It has introduced a new problem however. The or $Input2 seems to be getting triggered when I least expect it, by a GUICtrlSetData. I will have to re-think that logic. Thanks Sean
BrettF Posted April 24, 2007 Posted April 24, 2007 Bert,Of course. Yes that works.It has introduced a new problem however.The or $Input2 seems to be getting triggered when I least expect it, by a GUICtrlSetData.I will have to re-think that logic.ThanksSeanYes that does seem to happen. I know there's a fix somewhere.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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