XRT
I want to delete over 4000 nodes in an outliner, how can I do this quickly?
I tried setting XmNxrtGearRepaint to False but that does not seem to work.The outliner still updates after each node is deleted.
To understand the solution, you have ti understand how XtDestroyWidget works. It does not
immediatly destry the widget, but rather marks it for deletion. It only deletes the widget when
it is safe to do so. This means that the following code for example:
<pre>
/************Some callback or other function****************/
....
XtVaSetValues (outliner,
XmNxrtGearRepaint, False,
NULL);
/*
* Delete a lot of nodes in a for loop with
* XtDestroyWidget()
*/
XtVaSetValues (outliner,
XmNxrtGearRepaint, True,
NULL);
....
</pre>
will not work. The nodes actually get deleted after XmNxrtGearRepaint has been set to true
again.
Therefore, the correct way to do it is to use an AppTimeout with a time of 0 milliseconds.
This will be placed in the event loop and will be called after the the destroy widget event have
been processed. In this timeout, you can turn repaint back on.
<pre>
void
#ifndef _NO_PROTO
turnOn(XtPointer client_data, XtIntervalId *ID)
#else
turnOn (client_data, ID)
XtPointer client_data;
XtIntervalId *ID;
#endif
{
XtVaSetValues ((Widget)client_data,
XmNxrtGearRepaint, True,
NULL);
}
/************Some callback or other function****************/
....
XtVaSetValues (outliner,
XmNxrtGearRepaint, False,
NULL);
/*
* Delete a lot of nodes in a for loop with
* XtDestroyWidget()
*/
XtAppAddTimeOut (XtWidgetToApplicationContext(outliner), 0,
(XtTimerCallbackProc)turnOn, outliner );
....
</pre>
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy