We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Undo multi-level like VS.NET

Is there a sample somewhere that show how to develop a multi-level undo? I know I have to create my custom popup. Your VS.NET sample in the showcase shows it but I do not see any code sample.

5 Replies

AD Administrator Syncfusion Team May 8, 2002 10:58 AM UTC

I have attached a modified TextEditorForm.cs in our XPMenus sample that now has a undo-popup like the one you see in the VS.Net sample. Start looking at the "undoPopup" in the source. Do let me know if you have any trouble with this sample. -Praveen Ramesh


SL Sebastien Lange May 9, 2002 04:23 PM UTC

There were just 2 errors with the PopupControlContainer that does not accept 1 argument: this.undoPopup = new Syncfusion.Windows.Forms.PopupControlContainer();//(this.components); this.popupControlContainer1 = new Syncfusion.Windows.Forms.PopupControlContainer();//(this.components); Thanks, that's exactly what I was looking for. Sebastien


AD Administrator Syncfusion Team May 10, 2002 08:01 AM UTC

Thanks, you are welcome. -Praveen Ramesh


SL Sebastien Lange July 3, 2002 07:25 AM UTC

Hi, There is a small bug in the XPMenus sample, with the multiple undo. When you click to undo one action, you unselect this action so you should add: private void undoList_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { int index = this.undoList.IndexFromPoint(e.X, e.Y); if(index != -1) this.undoList.SetSelected(index, true); } Sebastien


SL Sebastien Lange July 4, 2002 07:47 AM UTC

That's not finished;-) If your stack contains more than 15 elements, you will not have the possibility to select more than 15 (the topindex is reset). You should change: private void undoList_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { int index = this.undoList.IndexFromPoint(e.X, e.Y); if(index != -1) { for(int i = index; i >= 0; i--) this.undoList.SetSelected(i, true); for(int i = index + 1; i < this.undoList.Items.Count; i++) this.undoList.SetSelected(i, false); index++; this.undoLabel.Text = "Undo " + index.ToString() + " Actions."; } } by private void undoList_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { int index = this.undoList.IndexFromPoint(e.X, e.Y); if(index != -1) { int topIndex = this.undoList.TopIndex; this.undoList.BeginUpdate(); for(int i = index; i >= 0; i--) this.undoList.SetSelected(i, true); for(int i = index + 1; i < this.undoList.Items.Count; i++) this.undoList.SetSelected(i, false); this.undoList.TopIndex = topIndex; this.undoList.EndUpdate(); index++; this.undoLabel.Text = "Undo " + index.ToString() + " Actions."; } } Begin & EndUpdate to avoid to much flashing but... this is not enough. Any idea to definitely remove this flash? Sebastien

Loader.
Live Chat Icon For mobile
Up arrow icon