[vtkusers] Print method output from Tcl script -- PROPOSAL

anast.jm at pg.com anast.jm at pg.com
Fri Feb 9 15:38:36 EST 2001


Chris

I tried this in a script where no output window opened normally and it seems to
work okay

vtkOutputWindow ow
     ow DisplayText [ow Print]

...john anast



                                                                
 Internet Mail Message                                          
 Received from host:      public.kitware.com                    
 [208.136.18.25]                                                
                                                                


From: "Volpe, Christopher R (CRD)" <volpecr at crd.ge.com>@public.kitware.com on
02/09/2001 12:35 PM
                                                                                              
            "Volpe, Christopher R (CRD)"           To:   "'Berk Geveci'"                      
 <volpecr at crd.ge.com>@public.kitware.com        <berk.geveci at kitware.com>,                    
                                                vtkusers at public.kitware.com                   
                                                   Cc:    (bcc: John Anast-JM/PGI)            
                                Sent by:   Subject:      RE: [vtkusers] Print method output   
       vtkusers-admin at public.kitware.com        from Tcl script -- PROPOSAL                   
                     02/09/2001 12:35 PM                                                      
                                                                                              
                                                                                              





|>
|>
|>   Chris,
|>
|>   It  looks like the answer is no. Here is the part of
|> vtkObjectTcl.cxx
|>   that handles Print:
|>
|>   if ((!strcmp("Print",argv[1]))&&(argc == 2))
|>     {
|>     ostrstream buf;
|>     op->Print(buf);
|>     buf.put('\0');
|>     Tcl_SetResult(interp,buf.str(),TCL_VOLATILE);
|>     delete buf.str();
|>     return TCL_OK;
|>     }
|>
|>   The output goes back to the tcl interpreter and I don't think it
|>         can be re-directed to the error window. But there has to
|>   be a way of re-directing tcl output to a tk window you create.
|>   If you really want the output to appear on the same
|> window as the
|>   error messages, you need to change the way the wrapper
|> handles Print
|>

Ok, except for the massive recompilation, does anyone have any serious
objections to this:

void vtkObject::PrintWindow()
{
  char *vtkmsgbuff;
  ostrstream vtkmsg;
  this->Print(vtkmsg);
  vtkmsgbuff = vtkmsg.str();
  vtkOutputWindowDisplayText(vtkmsgbuff);
  vtkmsg.rdbuf()->freeze(0);
}

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers








More information about the vtkusers mailing list