Mat Posted May 23, 2009 Posted May 23, 2009 (edited) I am trying to build undo and redo funcitonality into a script of mine that uses a normal edit control, and I was tring to find a way to redo as well. I found EM_REDO, but that for richedit controls. Does this mean there is no way to redo using GUICtrlSendMsg? Or Do I have to set a hotkey for ^z, save the text of the control, and undo. and then redo by restoring said txt... Just wondering as I am fairly new to the win commands, and I may have missed something obvious. MDiesel Also: WM_UNDO or EM_UNDO? It says on msdn that EM_UNDO is recommended for rich edit controls, but what about normal ones? I think i've given up on redo... Edited May 23, 2009 by mdiesel AutoIt Project Listing
MrCreatoR Posted May 23, 2009 Posted May 23, 2009 By default if you press «Ctrl + Z» you get the undo/redo functionality. But there is a functions (UDFs) like _GUICtrlEdit_Undo/_GUICtrlEdit_CanUndo, look in the help file. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
MrCreatoR Posted May 23, 2009 Posted May 23, 2009 P.SI supose it's possible to set custom buffer for Edit control, but it's better to use rich edit. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Mat Posted May 23, 2009 Author Posted May 23, 2009 (edited) Yep, I'm making it for a mene item. It's not the undo I'm struggling with, thats written and done. Its the redo I'm trying to find a proffessional solution for. the udfs just send the message for me, they don't help beyond that. MDiesel Edit: I was considering making it a rich edit control, even if I don't include full functionality. I might do that. Edited May 23, 2009 by mdiesel AutoIt Project Listing
Authenticity Posted May 23, 2009 Posted May 23, 2009 EM_CANUNDO will undo or redo the last operation perform on the edit control: EM_UNDO wParam = 0; // not used; must be zero lParam = 0; // not used; must be zero An application sends an EM_UNDO message to undo the last edit control operation. Parameters This message has no parameters. Return Value For a single-line edit control, the return value is always TRUE. For a multiline edit control, the return value is TRUE if the undo operation is successful, or FALSE if the undo operation fails. Remarks An undo operation can also be undone. For example, you can restore deleted text with the first EM_CANUNDO message, and remove the text again with a second EM_CANUNDO message as long as there is no intervening edit operation.
Mat Posted May 23, 2009 Author Posted May 23, 2009 (edited) ?? I cant' get that to work authenticity, And EM_CANUNDO doesn't mention it either. Can undo is for seeing if the undo buffer is empty or not. but... You can do it by re-sending EM_UNDO I found after a bit of playing around. But I think I'm going to make a rich edit anyway. Oh and, The edit example in the helpfile isn't working. I've tried using both beta + 3.3, and both helpfiles use the same examples. Is anyone else getting that? Unfortunately for me, I don't do much with objects, so I don't have a clue. MDiesel Edited May 23, 2009 by mdiesel AutoIt Project Listing
Authenticity Posted May 23, 2009 Posted May 23, 2009 (edited) Works fine for me: #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiEdit.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) $Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hEdit ; Create GUI GUICreate("Edit Undo", 400, 300) $hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268) GUISetState() _GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?") ; Undo MsgBox(4160, "Information", "Undo") _GUICtrlEdit_Undo($hEdit) MsgBox(4160, "Information", "Redo") _GUICtrlEdit_Undo($hEdit) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_MainoÝ÷ Ù±ßÛ"Ýý±©ç£(§Ø^éi~)^q©e²+tߨDv+[ºØßÛ#ºËZrí®H òÁ¬+&ºËp¢¹¢¼¨¹«¢+Ù}M¹5ÍÍ¡U% ÑɱÑ!¹± ÀÌØí¡¥Ð¤°ÀÌØí5}U9 Edited May 23, 2009 by Authenticity
Mat Posted May 23, 2009 Author Posted May 23, 2009 (edited) I meant the GUICtrlCreateEdit example. It creates a rich edit control (or tries to anyways) I was using GUICtrlSendMsg, that takes ID's. I have got that working now, it just needs neatening up. What were you saying with CANUNDO?? that didn't make sense. MDiesel Edit: This line:$oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") Edited May 23, 2009 by mdiesel AutoIt Project Listing
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