Hi again,

I have another problem along the same vein so I don't think I should create a 
new topic though feel free to correct me if I am wrong:

How can I deactivate my GUI button while the sensor attempts to connect and 
re-active the button only if the connection attempt has failed and been aborted?

Here's what I tried unsuccessfully in the callback for the connect button (the 
following code is fltk but should be applicable to any GUI library):


Code:

_connectButton->deactivate();
if(_scene->connectSensor())
{
    _disconnectButton->activate();
}
else
{
    _connectButton->activate();
}




The problem is _scene->connectSensor() is running in a thread, so the main 
thread sees false for the return of connectSensor() and re-activates the 
connectButton.

Note that _scene inherits from osgViewer::CompositeViewer and Fl_Gl_Window. I 
have already tried making it inherit from OpenThreads::Thread but when I try to 
re-implement the run() method, I get a conflict between CompositeViewer::run() 
and Thread::run(). I have thought about having my GUI poll the state of the 
sensor's connection to check if it has finished, but I'd like to know if there 
is a more elegant solution that escapes me.

As always, any assistance would be much appreciated.

Thanks!
Andrew[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47196#47196





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to