mocro Posted September 9, 2005 Share Posted September 9, 2005 Hello, Is it possible to disable mouse clicking over an Edit control? If I use the Style $ES_READONLY it will still accept mouse clicks which can cause havok when trying to append text. I tried setting the state of it to $GUI_DISABLE but that will also disable scroll bars. Any help would be greatly appreciated. Thanks, Link to comment Share on other sites More sharing options...
LxP Posted September 9, 2005 Share Posted September 9, 2005 I don't understand why the user moving the cursor would have any effect on the result. Are you using GUICtrlSetData() to modify the Edit's content? Link to comment Share on other sites More sharing options...
mocro Posted September 9, 2005 Author Share Posted September 9, 2005 (edited) Yes I am using guictrlsetdata to append data to the control as opposed to overwriting the text. eg. GUICtrlSetData($edit1, "data ", 1) I was refering to the mouse click specifically, not the movement over the control. If you put the above code in a loop it will add. data data data data ...etc to the edit. However if I click on the control while its looping, I may get ddata ata data dadata ta ... and so forth depending where I click in the control. Basically what I want to know is there a way I can append data to the end of the previously set data so that it won't be affected by mouse clicks? Edited September 9, 2005 by mocro Link to comment Share on other sites More sharing options...
LxP Posted September 9, 2005 Share Posted September 9, 2005 I would expect GUICtrlSetData() to fulfil your desired functionality by default. It doesn't make sense for the function to insert text at the cursor when you are instructing it to append -- perhaps this is an AutoIt bug.What does everyone else think? Link to comment Share on other sites More sharing options...
wiredbits Posted September 9, 2005 Share Posted September 9, 2005 Yes I am using guictrlsetdata to append data to the control as opposed to overwriting the text. eg.GUICtrlSetData($edit1, "data ", 1)I was refering to the mouse click specifically, not the movement over the control. If you put the above code in a loop it will add.data data data data...etc to the edit. However if I click on the control while its looping, I may getddata ata data dadata ta... and so forth depending where I click in the control.Basically what I want to know is there a way I can append data to the end of the previously set data so that it won't be affected by mouse clicks?<{POST_SNAPBACK}>It sounds like the cursor position is being set when you click the Edit box, try keeping your string values in a varable and just use Edit box for display. Link to comment Share on other sites More sharing options...
GaryFrost Posted September 9, 2005 Share Posted September 9, 2005 It sounds like the cursor position is being set when you click the Edit box, try keeping your string values in a varable and just use Edit box for display.<{POST_SNAPBACK}>And if that doesn't work, or you require more help, might be a good idea to post your code, would be easier to help you. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
mocro Posted September 9, 2005 Author Share Posted September 9, 2005 Thanks for the response. Here is the code I was tinkering with. #include <GUIConstants.au3> #Include <GuiEdit.au3> GUICreate("My GUI") $myedit=GUICtrlCreateEdit("", 10, 10, 380, 380, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY) GUISetState() While 1 GUICtrlSetData ($myedit, "data ", 1) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd I can use a variable to hold the value however I was thinking that I would have to overwrite the edit control everytime I want to append new data. Its only a few extra lines of code and probably the only way. Unless there is a GUI constant I'm not aware of or I'm not using the advanced option in guictrlsetdata properly. Link to comment Share on other sites More sharing options...
LxP Posted September 10, 2005 Share Posted September 10, 2005 I'm not aware of any special GUI constant and you appear to be using the GuiCtrlSetData() function properly. I hope that this thread receives the attention of a developer because this behaviour definitely sounds buggy. Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 Not buggy:GUICtrlSetData ( controlID, data [, default])default - for Edit, Input : if defined and not "" the "data" string is inserted not overriding the previous value at the cursor point. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
LxP Posted September 10, 2005 Share Posted September 10, 2005 Ugh, how embarrassing. I could have sworn that the flag indicates an append. When did I forget how to read? Your options are to keep the entire output in a separate variable and overwrite the entire contents of the Edit control each time, or to force the cursor to the end of the current data immediately before inserting the new data (it can be done with _GUICtrlEditSetSel() but there's probably a more intuitive way). Link to comment Share on other sites More sharing options...
WSCPorts Posted September 10, 2005 Share Posted September 10, 2005 if the data is highlighted it automatically overwrites it. http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32] Link to comment Share on other sites More sharing options...
GaryFrost Posted September 10, 2005 Share Posted September 10, 2005 #include <GUIConstants.au3> #Include <GuiEdit.au3> #include <Misc.au3> $GUI = GUICreate("My GUI", 500, 390) $myedit = GUICtrlCreateEdit("", 10, 10, 380, 380, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY) $Button = GUICtrlCreateButton("Exit", 400, 20, 90, 25) GUISetState() _NoClick() While 1 GUICtrlSetData($myedit, "data ", 1) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button ExitLoop EndSelect _NoClick() WEnd _MouseTrap () Func _NoClick() Local $coords = WinGetPos($GUI) _MouseTrap ($coords[0] + 390, $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3]) EndFunc ;==>_NoClick SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
mocro Posted September 10, 2005 Author Share Posted September 10, 2005 Thanks a bunch for everyone's help again. I got some good ideas from this discussion and I appreciate the added code and suggestions. Link to comment Share on other sites More sharing options...
LxP Posted September 11, 2005 Share Posted September 11, 2005 if the data is highlighted it automatically overwrites it.<{POST_SNAPBACK}>Yes, but my theory was that you could 'set a selection that starts at the very end and ends at the very end', thereby simply moving the cursor to the very end without a resultant selection. 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