FinalVersion Posted May 14, 2009 Share Posted May 14, 2009 Current Code: Func CheckCmd() $Check = GUICtrlRead($Main) Select Case $Check = "Help" GUICtrlSetData($Main, "Line1" & @CRLF & "Line2") Case $Check = "Clear" GUICtrlSetData($Main, "") EndSelect EndFunc ;==>CheckCmd When help is typed enter pushed, Line1 Line2 should show etc. Help is appreciated. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
nguyenbason Posted May 14, 2009 Share Posted May 14, 2009 i got this from AutoIT examples folder While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;When button is pressed, label text is changed ;to combobox value Case $msg = $button1 $data = GUICtrlRead($Combo_2) GUICtrlSetData($Label_1, $data) EndSelect WEnd Hope it helps you. UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
FinalVersion Posted May 14, 2009 Author Share Posted May 14, 2009 i got this from AutoIT examples folder While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;When button is pressed, label text is changed ;to combobox value Case $msg = $button1 $data = GUICtrlRead($Combo_2) GUICtrlSetData($Label_1, $data) EndSelect WEnd Hope it helps you.$Main is a edit box. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Authenticity Posted May 14, 2009 Share Posted May 14, 2009 expandcollapse popup#include <Constants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> $hGUI = GUICreate('Title', 300, 100) $Edit = GUICtrlCreateEdit('', 10, 20, 280, 60, BitOR($ES_WANTRETURN, $__EDITCONSTANT_WS_HSCROLL,$ES_AUTOHSCROLL)) $hEdit = GUICtrlGetHandle(-1) $hOldProc = _WinAPI_GetWindowLong($hEdit, $GWL_WNDPROC) $hFunc = DllCallbackRegister('WndProc', 'long', 'hwnd;uint;wparam;lparam') $pFunc = DllCallbackGetPtr($hFunc) _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, $pFunc) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() DllCallbackFree($hFunc) Exit Func CheckCmd($sString) EndFunc ;==>CheckCmd Func WndProc($hwnd, $iMsg, $iwParam, $ilParam) If $iMsg = $WM_CHAR Then If $iwParam = 13 Then Switch GUICtrlRead($Edit) Case "help" GUICtrlSetData($Edit, "Line1" & @CRLF & "Line2") Case "clear" GUICtrlSetData($Edit, "") EndSwitch EndIf EndIf Return _WinAPI_CallWindowProc($hOldProc, $hwnd, $iMsg, $iwParam, $ilParam) EndFunc Link to comment Share on other sites More sharing options...
enaiman Posted May 14, 2009 Share Posted May 14, 2009 (edited) Your code is OK. Are you sure the function CheckCmd() is called? You can see that it works: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 347, 120, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Main = GUICtrlCreateEdit("", 8, 8, 329, 65) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Button1", 136, 88, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "CheckCmd") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func CheckCmd() $Check = GUICtrlRead($Main) Select Case $Check = "Help" GUICtrlSetData($Main, "Line1" & @CRLF & "Line2") Case $Check = "Clear" GUICtrlSetData($Main, "") EndSelect EndFunc Func Form1Close() Exit EndFunc Edited May 14, 2009 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
FinalVersion Posted May 14, 2009 Author Share Posted May 14, 2009 expandcollapse popup#include <Constants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> $hGUI = GUICreate('Title', 300, 100) $Edit = GUICtrlCreateEdit('', 10, 20, 280, 60, BitOR($ES_WANTRETURN, $__EDITCONSTANT_WS_HSCROLL,$ES_AUTOHSCROLL)) $hEdit = GUICtrlGetHandle(-1) $hOldProc = _WinAPI_GetWindowLong($hEdit, $GWL_WNDPROC) $hFunc = DllCallbackRegister('WndProc', 'long', 'hwnd;uint;wparam;lparam') $pFunc = DllCallbackGetPtr($hFunc) _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, $pFunc) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() DllCallbackFree($hFunc) Exit Func CheckCmd($sString) EndFunc ;==>CheckCmd Func WndProc($hwnd, $iMsg, $iwParam, $ilParam) If $iMsg = $WM_CHAR Then If $iwParam = 13 Then Switch GUICtrlRead($Edit) Case "help" GUICtrlSetData($Edit, "Line1" & @CRLF & "Line2") Case "clear" GUICtrlSetData($Edit, "") EndSwitch EndIf EndIf Return _WinAPI_CallWindowProc($hOldProc, $hwnd, $iMsg, $iwParam, $ilParam) EndFunc Thank you. @enaiman Its called by _ispressed func. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
enaiman Posted May 14, 2009 Share Posted May 14, 2009 Its called by _ispressed func.Then why it failed if it was really called?I guess you didn't bother to look at my example to see that your function works. Better for me to avoid wasting my time in the future SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
FinalVersion Posted May 14, 2009 Author Share Posted May 14, 2009 Then why it failed if it was really called?I guess you didn't bother to look at my example to see that your function works. Better for me to avoid wasting my time in the future called used w.e when a button is pressed the func is used. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] 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