Sign in to follow this  
Followers 0
Mat

EM_REDO

8 posts in this topic

#1 ·  Posted (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 by mdiesel

Share this post


Link to post
Share on other sites



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_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

P.S

I 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_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by mdiesel

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by mdiesel

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Authenticity

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by mdiesel

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0