From: guigues Date: Wed, 11 Feb 2009 12:23:12 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~103 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e86c3848d48592893231e57fbf513d5d666be0ca;p=bbtk.git *** empty log message *** --- diff --git a/samples/SampleInterpreter/bbtkSampleInterpreter.cxx b/samples/SampleInterpreter/bbtkSampleInterpreter.cxx index 91f4ff0..6100d5e 100644 --- a/samples/SampleInterpreter/bbtkSampleInterpreter.cxx +++ b/samples/SampleInterpreter/bbtkSampleInterpreter.cxx @@ -31,7 +31,8 @@ int main(int argv, char* argc[]) std::cout << "Enter a number : "; double num = 0; std::cin >> num; - // Set its input 'In' to 1 + + // Set its input 'In' to num p->bbSetInput("In",num); // Execute it @@ -46,7 +47,22 @@ int main(int argv, char* argc[]) std::cout << num << "+1 = "<InterpretLine("new Processing a"); + // We get a the black box "a" in the workspace: + bbtk::BlackBox::Pointer a + = I->GetExecuter()->GetWorkspace()->GetPrototype()->bbGetBlackBox("a"); + // Then the same as previously... + a->bbSetInput("In",num); + a->bbExecute(); + double w = p->bbGetOutput("Out").get(); + std::cout << "In case you did not understand:"<bbSetInputWinDialog(true); // mandatory + // Add the observer slider->bbAddOutputObserver( "Out", &CallbackFunction ); slider->bbExecute(); } @@ -42,6 +46,7 @@ void SliderCallback() //========================================================================= +// SECOND EXAMPLE : MEMBER METHOD CALLED WHEN SLIDER IS RELEASED class ClassWithTwoSliders { public: @@ -66,6 +71,9 @@ ClassWithTwoSliders::ClassWithTwoSliders() try { mSlider1 = bbwx::Slider::New("slider1"); + // Add the observer method + // As it is not a FREEHAND function we must use the macro + // BBTK_MAKE_OUTPUT_OBSERVER which takes the object and the method to call mSlider1->bbAddOutputObserver("Out", BBTK_MAKE_OUTPUT_OBSERVER (this, diff --git a/samples/SampleWidgetsBase/bbtkSampleWidgetsBase.cxx b/samples/SampleWidgetsBase/bbtkSampleWidgetsBase.cxx index 481c828..6163c94 100644 --- a/samples/SampleWidgetsBase/bbtkSampleWidgetsBase.cxx +++ b/samples/SampleWidgetsBase/bbtkSampleWidgetsBase.cxx @@ -3,7 +3,7 @@ //========================================================================= // Different examples of using black boxes in C++ -// Here we do not use wxWidgets however WxBlackBox es work in **Dialog** mode +// Here we do not use wxWidgets however WxBlackBox work in **Dialog** mode //========================================================================= //=========================================================================