View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000842VTK(No Category)public2004-05-14 05:262011-01-13 17:00
ReporterGoodwin Lawlor 
Assigned ToMathieu Malaterre 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000842: Abort firing events in tcl proc
Descriptiona vtkTclCommand can't set the AbortFlag to stop firing events... but if a tcl proc returned with "return -code -1" then this

Index: vtkTclUtil.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Common/vtkTclUtil.cxx,v
retrieving revision 1.81
diff -u -r1.81 vtkTclUtil.cxx
--- vtkTclUtil.cxx 14 Nov 2003 20:43:25 -0000 1.81
+++ vtkTclUtil.cxx 14 May 2004 09:17:09 -0000
@@ -657,6 +657,10 @@
                              this->Interp->errorLine);
       }
     }
+ else if (res == -1)
+ {
+ this->AbortFlagOn();
+ }
 }

would set the AbortFlag and stop firing events.
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0001046)
Mathieu Malaterre (developer)
2004-05-14 13:34

This is dixed in CVS, thank you Goodwin.

Checking in vtkTclUtil.cxx;
/cvsroot/VTK/VTK/Common/vtkTclUtil.cxx,v <-- vtkTclUtil.cxx
new revision: 1.82; previous revision: 1.81
done
(0001048)
Mathieu Malaterre (developer)
2004-05-15 15:17

Adding Tcl sample:

There's a small change just checked into CVS that's handy when using the
Observer/Callback mechanism in VTK with Tcl.

If a callback returns with

return -code -1

then subsequent callbacks observing an event are not fired. Its the same as
"vtkCommand *command->AbortFlagOn()" in C++.

For example, if you want the first callback observing an EndPickEvent of a
vtkCellPicker to check if the "f" or "p" key was pressed you could have:

vtkRenderWindowInteractor iren
    iren SetPicker picker
vtkCellPicker picker
    picker AddObserver EndPickEvent cbCheckKey
    picker AddObserver EndPickEvent cbDisplayPoint

proc cbCheckKey {} {
    if {[iren GetKeySym] == "f"} {
        return -code -1
    }
}

proc cbDisplayPoint {}{
    puts "You picked point: [picker GetPickPosition]"
}

If the "f" key is pressed then the cbDisplayPoint callback is not executed,
because cbCheckKey has set the abort flag.




 Issue History
Date Modified Username Field Change
2010-11-29 17:59 Mathieu Malaterre Source_changeset_attached => VTK master 9c20a773
2011-01-13 17:00 Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00 Source_changeset_attached => VTK master 020ef709
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team