pr1 Posted October 27, 2008 Share Posted October 27, 2008 Hi, I have written an AutoIt application which displays a window, reads lots of files in directories and sub-directories, and outputs occurrences of a particular string in the files to the window's edit control. Althought the edit control is readonly, if the user clicks it, say, in the middle, the text output by the application appears where the user clicked, not at the bottom of the edit control anymore. Is there a way to prevent users from clicking inside an edit control? Many thanks. pr1 Link to comment Share on other sites More sharing options...
Andreik Posted October 27, 2008 Share Posted October 27, 2008 Hi,I have written an AutoIt application which displays a window, reads lots of files in directories and sub-directories, and outputs occurrences of a particular string in the files to the window's edit control. Althought the edit control is readonly, if the user clicks it, say, in the middle, the text output by the application appears where the user clicked, not at the bottom of the edit control anymore. Is there a way to prevent users from clicking inside an edit control?Many thanks.pr1With ControlDisable() function. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
pr1 Posted October 27, 2008 Author Share Posted October 27, 2008 With ControlDisable() function.Many thanks. The only problem is that it dims the text in the edit control, but I guess, I can't have it all. Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 27, 2008 Share Posted October 27, 2008 GUICtrlSetBkColor() to white. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
rover Posted October 27, 2008 Share Posted October 27, 2008 Hi, I have written an AutoIt application which displays a window, reads lots of files in directories and sub-directories, and outputs occurrences of a particular string in the files to the window's edit control. Althought the edit control is readonly, if the user clicks it, say, in the middle, the text output by the application appears where the user clicked, not at the bottom of the edit control anymore. Is there a way to prevent users from clicking inside an edit control? Many thanks. pr1@pr1 subclass the edit control and block WM_SETFOCUS messages expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiEdit.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GUIConstantsEX.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) Global $hEdit, $wProcOld, $wProcNew Global $hGUI, $Edit, $msg ; Create GUI $hGUI = GUICreate("Edit Create", 400, 300) $Edit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268, $ES_READONLY) GUICtrlSetBkColor(-1, 0xFFFFFF) ; Subclass edit control $hEdit = GUICtrlGetHandle($Edit) ; if using _GUICtrlEdit_Create() then omit this line $wProcNew = DllCallbackRegister("_EditWindowProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew)) GUISetState() _GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?") _GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?") Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE ; required on exit if subclassing ; reset window procedure for edit control If $wProcOld Then _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, $wProcOld) EndIf ; Delete callback function If $wProcNew Then DllCallbackFree($wProcNew) GUIDelete() Exit ; subclass function Func _EditWindowProc($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_SETFOCUS;, $WM_NCHITTEST Return 0 EndSwitch ;pass the unhandled messages to default WindowProc Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_EditWindowProc I see fascists... 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