tehsage Posted August 24, 2006 Posted August 24, 2006 I'm trying to make it so that when a user types something in the Edit, it changes a boolean to False. Any ideas?
ame1011 Posted August 24, 2006 Posted August 24, 2006 tehsage said: I'm trying to make it so that when a user types something in the Edit, it changes a boolean to False. Any ideas?I reccomend looking up the simple GUI scripts found in the helpfile [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
GaryFrost Posted August 25, 2006 Posted August 25, 2006 expandcollapse popup#include <GuiConstants.au3> Global Const $WM_COMMAND = 0x0111 Global Const $EN_CHANGE = 0x300 Global Const $EN_SETFOCUS = 0x100 Global Const $EN_KILLFOCUS = 0x200 Global Const $DebugIt = 1 Global $changed = False GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered $edit = GUICtrlCreateEdit("This is a test, this is only a test", 80, 50, 270, 170) ; create first item $btn = GUICtrlCreateButton("Ok", 40, 230, 60, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $changed = True ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Changed:" & GUICtrlRead($edit)) If $DebugIt Then _DebugPrint(StringLen(GUICtrlRead($edit))) ;---------------------------------------------------------------------------------------------- $changed = False EndSelect WEnd Func _Edit_Changed() $changed = True EndFunc ;==>_Edit_Changed Func _Edit_GotFocus() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Got Focus") ;---------------------------------------------------------------------------------------------- EndFunc ;==>_Edit_GotFocus Func _Edit_LostFocus() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Lost Focus") ;---------------------------------------------------------------------------------------------- EndFunc ;==>_Edit_LostFocus Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = _HiWord($wParam) Local $nID = _LoWord($wParam) Local $hCtrl = $lParam Switch $nID Case $edit Switch $nNotifyCode Case $EN_CHANGE _Edit_Changed() Case $EN_SETFOCUS _Edit_GotFocus() Case $EN_KILLFOCUS _Edit_LostFocus() EndSwitch EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWord SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
tehsage Posted August 25, 2006 Author Posted August 25, 2006 gafrost said: expandcollapse popup#include <GuiConstants.au3> Global Const $WM_COMMAND = 0x0111 Global Const $EN_CHANGE = 0x300 Global Const $EN_SETFOCUS = 0x100 Global Const $EN_KILLFOCUS = 0x200 Global Const $DebugIt = 1 Global $changed = False GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered $edit = GUICtrlCreateEdit("This is a test, this is only a test", 80, 50, 270, 170) ; create first item $btn = GUICtrlCreateButton("Ok", 40, 230, 60, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $changed = True ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Changed:" & GUICtrlRead($edit)) If $DebugIt Then _DebugPrint(StringLen(GUICtrlRead($edit))) ;---------------------------------------------------------------------------------------------- $changed = False EndSelect WEnd Func _Edit_Changed() $changed = True EndFunc ;==>_Edit_Changed Func _Edit_GotFocus() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Got Focus") ;---------------------------------------------------------------------------------------------- EndFunc ;==>_Edit_GotFocus Func _Edit_LostFocus() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Edit Lost Focus") ;---------------------------------------------------------------------------------------------- EndFunc ;==>_Edit_LostFocus Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = _HiWord($wParam) Local $nID = _LoWord($wParam) Local $hCtrl = $lParam Switch $nID Case $edit Switch $nNotifyCode Case $EN_CHANGE _Edit_Changed() Case $EN_SETFOCUS _Edit_GotFocus() Case $EN_KILLFOCUS _Edit_LostFocus() EndSwitch EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWordI kinda understand...not sure though. =/
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