wxWidgets - RichTextCtrl - Is ther one?

Thread Solved

Join Date: Nov 2008
Posts: 3
Reputation: alvinru is an unknown quantity at this point 
Solved Threads: 1
alvinru alvinru is offline Offline
Newbie Poster

Re: wxWidgets - RichTextCtrl - Is ther one?

 
0
  #11
Nov 9th, 2008
OK. I've tried saving and loading XML files produced by the RichTextCtrl demo on Linux, and everything worked without a hitch.

I'm running Linux Mint 5.0 (derived from Ubuntu 8.04), wxPython 2.8.9.1.

If you have an older version of wxPython, maybe that's why it doesn't work.

Please make sure that when loading the document back you select the correct filter (not txt, but xml).
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: wxWidgets - RichTextCtrl - Is ther one?

 
0
  #12
Nov 9th, 2008
Hmm, I'm using wxPython 2.8.9.1 and Ubuntu 7.10 but I can see a possible problem here:

When it comes to loading, there is no choice of filters, only "*" - this might well be the cause of the problem.

Iv had a look at the code for the demo, but I cant see how to change the filter on the load event. Ill have to try and work that out before I go any further because if this works my problem is solved - I don't care what format the text is saved in, just so long as it can be saved and loaded and look like RTF style text to the user.

Many thanks for your efforts, and if you have any tips about how to get that load filter set up on the demo Id be more than happy to try it out!

Regards

Max
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: wxWidgets - RichTextCtrl - Is ther one?

 
0
  #13
Nov 9th, 2008
Okay, the problem has been sorted out now:

The demo saves nicely in XML (.xml or .ox) but when it comes to loading the code is not correct and the filter only shows *.*

To correct this, in the OnFileOpen routine, the following change must be made:

  1. def OnFileOpen(self, evt):
  2. wildcard, types = rt.RichTextBuffer.GetExtWildcard(save=False)
  3. dlg = wx.FileDialog(self, "Choose a filename",
  4. #The following line was changed from "*.*"
  5. wildcard=wildcard,
  6. style=wx.OPEN)
  7. if dlg.ShowModal() == wx.ID_OK:
  8. path = dlg.GetPath()
  9. if path:
  10. fileType = types[dlg.GetFilterIndex()]
  11. self.rtc.LoadFile(path, fileType)
  12. dlg.Destroy()

Having made this change the control will save as XML and load from XML and display as Rich Text! The problem is now fixed, so many thanks to everyone who tried to help out, but especially to alvinru for pointing in the right direction!

Regards

Max
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC