czardas Posted March 31, 2013 Share Posted March 31, 2013 (edited) I believe this is a windows bug. I don't know if it is specific to XP. Please try the following test. Do you get the same results as I do?1. Run the reproducer2. Wait one second and then type some text,3. Press Ctrl+Z#include <GuiEdit.au3> #include <GuiConstantsEx.au3> _Reproducer() Func _Reproducer() Local $hGUI, $hEdit $hGUI = GUICreate("Edit Create", 400, 300) $hEdit = _GUICtrlEdit_Create($hGUI, "0x0045", 2, 2, 394, 268) ;$hEdit = GUICtrlCreateEdit("0x8345", 2, 2, 394, 268) ; Native function GUISetState() Sleep(1000) ; Please wait _GUICtrlEdit_ReplaceSel($hEdit,ChrW(0x0045)) _GUICtrlEdit_SetSel($hEdit, 0, 0) ; Position to start typing Do ; Type something ; Press Ctrl+Z Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_ReproducerMy Results:At first you see 0x0045. This is replaced with the letter E ==> ChrW(0x0045)If you now type the letter A, the result should be AEPressing Ctrl+Z does not revert to an earlier rendering.Instead the result will be 0x0045E. This is not a successful undo operation. Edited March 31, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JohnOne Posted March 31, 2013 Share Posted March 31, 2013 (edited) Same results Win 7 32. Does not occur if there is no text initially in edit control. Edited March 31, 2013 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
kylomas Posted March 31, 2013 Share Posted March 31, 2013 Same Win7 64bit Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
czardas Posted March 31, 2013 Author Share Posted March 31, 2013 Thanks for testing JohnOne and kylomas. It doesn't occur if you type letters after the replaced hex. It also does not occur if you paste the hex into the control. It only seems to occur when you use _GUICtrlEdit_ReplaceSel to replace the hex, and then type something before the replaced characters. At first I thought it might be an AutoIt bug, but I'm not convinced this is the case. Perhaps some more advanced members can shed some light on this. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
FireFox Posted April 1, 2013 Share Posted April 1, 2013 Hm... interesting, this does not happend if you use a raw string but the _GUICtrlEdit_SetSel function is needed to create the bug. On the contrary there is no problem on Win8 64bits. (Windows issue I guess) Br, FireFox. czardas 1 Link to comment Share on other sites More sharing options...
czardas Posted April 1, 2013 Author Share Posted April 1, 2013 On the contrary there is no problem on Win8 64bits. (Windows issue I guess)Hmm right. If it's a windows issue, I wonder why it took so long to fix. Perhaps the undo operation is the culprit, rather than the method used to add the text. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
kylomas Posted April 1, 2013 Share Posted April 1, 2013 czardas, I tried this #include <GuiEdit.au3> #include <GuiConstantsEx.au3> hotkeyset('^z',"undo") local $hedit _Reproducer() Func _Reproducer() Local $hGUI, $hEdit $hGUI = GUICreate("Edit Create", 400, 300) $hEdit = _GUICtrlEdit_Create($hGUI, "0x0045", 2, 2, 394, 268) ;$hEdit = GUICtrlCreateEdit("0x8345", 2, 2, 394, 268) ; Native function GUISetState() Sleep(1000) ; Please wait _GUICtrlEdit_ReplaceSel($hEdit,ChrW(0x0045)) _GUICtrlEdit_SetSel($hEdit, 0, 0) ; Position to start typing sleep(3000) _guictrledit_undo($hedit) Do ; Type something ; Press Ctrl+Z Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Reproducer func undo() ConsoleWrite('Undo actioned' & @LF) consolewrite(_guictrledit_undo($hedit) & @lf) endfunc but I don't think I'm using the functions or hotkey correctly (never used a hotkey before). The undo from the function always returns "false" (failure). kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
czardas Posted April 1, 2013 Author Share Posted April 1, 2013 (edited) kylomas The biggest problem with your script is that you are trying to reset a windows default hotkey for the edit control. You can't override Ctrtl+Z with a user defined hotkey (or accelerator) when working with an edit control. Edited April 1, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
kylomas Posted April 1, 2013 Share Posted April 1, 2013 Yea, was trying different shit... Happy Easter! kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
czardas Posted April 1, 2013 Author Share Posted April 1, 2013 (edited) I often try things I'm told to avoid too. ^^ Happy easter to you too, and to everyone else. Edited April 1, 2013 by czardas operator64 ArrayWorkshop 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