cueclub Posted April 11, 2010 Share Posted April 11, 2010 If I were to use an edit box, Could I pull info or activate functions from within the edit box depending on what I type? Here is what I have tried so far: expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $GUIWidth = 300, $GUIHeight = 250 Local $Edit_1, $OK_Btn, $Cancel_Btn, $msg GUICreate("test edit", $GUIWidth, $GUIHeight) $Edit_1 = GUICtrlCreateEdit("", 10, 10, 280, 190) $OK_Btn = GUICtrlCreateButton("OK", 75, 210, 70, 25) $Cancel_Btn = GUICtrlCreateButton("Cancel", 165, 210, 70, 25) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit Case $msg = $OK_Btn If $edit_1 = "test" Then MsgBox(0, "test edit", "You typed Test") EndIf EndSelect WEnd EndFunc ;==>_Main Would I have to send it to an INI and then recall it later, or would it just act once I press enter? Thanks Cue Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 11, 2010 Share Posted April 11, 2010 (edited) I suppose $edit_1 could be processed after it is submitted (with StringInStr maybe?) and something done if something specific is found in that variable.Here's an example using your code:#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $GUIWidth = 300, $GUIHeight = 250 Local $Edit_1, $OK_Btn, $Cancel_Btn, $msg GUICreate("test edit", $GUIWidth, $GUIHeight) $Edit_1 = GUICtrlCreateEdit("", 10, 10, 280, 190) $OK_Btn = GUICtrlCreateButton("OK", 75, 210, 70, 25) $Cancel_Btn = GUICtrlCreateButton("Cancel", 165, 210, 70, 25) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit Case $msg = $OK_Btn If StringInStr(GUICtrlRead($Edit_1), "test") > 0 Then MsgBox(0, "", "'test' found") Else MsgBox(0, "", "'test' not found") EndIf EndSelect WEnd EndFunc ;==>_Main Edited April 11, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cueclub Posted April 11, 2010 Author Share Posted April 11, 2010 ah ok i didn't even think about that. Will give it a try, wonder if I could use it for multiple lines. I will look into it and post again if i hit a snag. Thanks Somd j/k somdcomputerguy Cue Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 11, 2010 Share Posted April 11, 2010 (edited) For multiple tests, it might be easier and better to use Select or Switch statements rather than If's, especially if there's alot of tests to do. There was another reference to snow, so I figured it was just easier to change my userid rather than PM'ing everybody who says snow instead of snowmaker. Edited April 11, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cueclub Posted April 11, 2010 Author Share Posted April 11, 2010 lol glad I'm not the only one who made the mistake. Thanks for the suggestion Cue 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