wxTextCtrl and Undos

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
wxNewbi
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Nov 15, 2004 11:27 pm
Location: London UK
Contact:

wxTextCtrl and Undos

Post by wxNewbi » Tue Jan 04, 2005 2:19 pm

Hello I am trying to use the UNDO facility of the wxTextCtrl but I can't get it to work, when I delete something from the text in the window and press control z it doesn't undo what I did. Thi s is the same thing that happens when I typing text into the window. I can copy and paste but not undo. the Wx manual says the wxUNDO_ID event is handled internally by the control. So why don't it work? Do I have to enable it? if so How?

Also if I want my editor to be able to open a file of >1Mb, how will I do it ?

thanks
Keep it real, Keep it free, Keep it GPL

frrossk
Earned a small fee
Earned a small fee
Posts: 11
Joined: Mon Dec 20, 2004 8:48 am

Post by frrossk » Wed Jan 05, 2005 7:02 am

>>Also if I want my editor to be able to open a file of >1Mb, how will I do it ?

I think you have to define the style for your wxTextCtrl window as wxTE_RICH (I'm assuming you are working on Windows).

leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio » Wed Jan 05, 2005 1:03 pm

In turn I am going to assume you are talking about wxGTK or another non-wxMSW port.
wxTextCtrl::CanUndo

Returns true if there is an undo facility available and the last operation can be undone.
This should return on wxGTK and some other ports, as there is no undo facility available. wxGTK native text control does not have an undo facility (what I'd call an overhead anyway in many cases), and so it wasn't trivial to support it and the support is not there atm.
I have "Implement an unco facility for wxGTK wxTextCtrl" in my TODO list, but no promises :o
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/

wxNewbi
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Nov 15, 2004 11:27 pm
Location: London UK
Contact:

Post by wxNewbi » Wed Jan 05, 2005 2:24 pm

Thanks a lot guys, I am sorry I was not specific. I am using wxGTK and I hope wxTE_RICH does the same thing in wxGTK.

thanks again
Keep it real, Keep it free, Keep it GPL

leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio » Thu Jan 06, 2005 4:07 am

wxTE_RICH is ignored on other platforms than wxMSW. As stated in the manual.

About the limit, I can't imagine one being there other than the max size of gint, that is G_MAXINT which is usually 4294967295, which is 4GB of text in textbuffer sense. Due to unicode it might be times smaller but still should reach to gigabytes.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/

Post Reply