]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxCommandButton.cxx
* Created an invisible frame child of WxConsole to be temporary parent of all widgets...
[bbtk.git] / packages / wx / src / bbwxCommandButton.cxx
index b13d2426e5998f829cca4e09725336780dc62374..5c34cd5d140154c7f819001c750832345d833744 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxCommandButton.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/15 12:47:17 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/03/07 11:37:48 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 
   l'Image). All rights reserved. See Doc/License.txt or
@@ -66,7 +66,26 @@ namespace bbwx
   
   void CommandButtonWidget::OnCommandButton( wxEvent& )
   {
-    std::string commandstr(mBox->bbGetInputIn());
+    // Look for the interpreter
+      bbtk::Interpreter* I = 0;
+      if (mBox->bbGetParent() != 0) 
+       {
+         bbtk::Factory* f = 
+           ((bbtk::ComplexBlackBoxDescriptor*)mBox->bbGetParent()
+            ->bbGetDescriptor())->GetFactory();
+         if ((f != 0)&&
+             (f->GetExecuter()))
+           {
+             I = f->GetExecuter()->GetInterpreter();
+           }
+       }
+      if (I==0) 
+       {
+         //      bbtkError("ExecBbiCommand::DoProcess() : could not find interpreter");
+         I = new bbtk::Interpreter();
+       }
+      
+      std::string commandstr(mBox->bbGetInputIn());
     
     // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr );
     int i;
@@ -93,7 +112,7 @@ namespace bbwx
              }
          }             
        bool insideComment = false; // for multiline comment
-       bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand, insideComment );
+       I->InterpretLine( ccommand, insideComment );
        pos1=pos2+1;
        pos2 = commandstr.find(";",pos2+1);