From: Paul K <pau...@ya...> - 2012-08-17 02:57:02
|
Hi all, I'm working with an application that saves data in files and some of the operations may trigger file errors. I'm handling those errors myself and don't want to see the standard error message shown by wxwidgets. How do I disable it? Here is the code that I have: local file = wx.wxFile(filename, wx.wxFile.write) file:Write("something", #"something") If the file is write protected, I get "can't open file '...' (error 5: access is denied)". I know, I can check for that condition, but this is not what the question is about. I'd like to disable that message. Here is what I tried so far: 1. use wxLogNull. I read C++ examples, but not sure how this should be used in wxlua (according to examples, you just need to "instantiate" this logNull object): local log = wx.wxLogNull() file:Write(....) log:delete() This has no effect. 2. use SetActiveTarget() local log = wx.wxLog.SetActiveTarget(wx.wxLogNull()) file:Write(....) wx.wxLog.SetActiveTarget(log) This doesn't work as SetActiveTarget expects wxLog object, but wxLogNull doesn't seem to be inherited from wxLog (according to wxlua docs). 3. use EnableLogging on either wx.wxLogGui() or wx.wxLog() local curr = wx.wxLogGui().EnableLogging(false) file:Write(....) wx.wxLogGui().EnableLogging(curr) This has no effect. What is the right way to (temporarily) disable logging such that I don't get the log window? Thanks. Paul. |