Bruno Fanini schrieb:
Hi all,

I' m developing a wxWidget (2.6.3) + OSG (1.2) App, and I'd like to redirect osg messages pushed out ( with osg::notify() ) on my status bar on main frame.
Is there a simple way to perform this task? Or just using another wx structure?

Hi,

I think the following class should help you:
----------------------------------------------citation from wx manual

wxStreamToTextRedirector

This class can be used to (temporarily) redirect all output sent to a C++ ostream object to a wxTextCtrl instead.

NB: Some compilers and/or build configurations don't support multiply inheriting wxTextCtrl from std::streambuf in which case this class is not compiled in. You also must have wxUSE_STD_IOSTREAM option on (i.e. set to 1) in your setup.h to be able to use it. Under Unix, specify --enable-std_iostreams switch when running configure for this.

Example of usage:

  using namespace std;

  wxTextCtrl *text = new wxTextCtrl(...);

  {
    wxStreamToTextRedirector redirect(text);

    // this goes to the text control
    cout << "Hello, text!" << endl;
  }

  // this goes somewhere else, presumably to stdout

  cout << "Hello, console!" << endl;

---------------------------end citation

This will enable you to redirect the osg-notifys to a text-ctrl.
If you want to have it in the status bar, you could hide the text-ctrl and update the statusbar when the textcontrol is changed or have a look at the sources how this is done.
Anyway, as the osgNotifys are multiline sometimes, having a textcontrl (with scrollbar!) will be more useful anyway.

Regards,

Andreas
TIA

--
Bruno Fanini

_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to