Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Xt_Stopwatch / Stopwatch_display.cpp
blobb3826ed29f995fbed43746f512459d713709839d
1 #include "Stopwatch_display.h"
2 #include "ace/OS_NS_stdio.h"
4 Stopwatch_display::Stopwatch_display (Widget &parent)
6 // Instantiate the sub-components of the Stopwatch_display
7 this->frame_ = XtCreateWidget ("frame",
8 xmFrameWidgetClass,
9 parent,
11 0);
13 this->label_ = XtCreateWidget ("label",
14 xmLabelWidgetClass,
15 this->frame_,
17 0);
20 Stopwatch_display::~Stopwatch_display ()
22 //No-op
25 void
26 Stopwatch_display::manage ()
28 XtManageChild (this->frame_);
29 XtManageChild (this->label_);
32 void
33 Stopwatch_display::set_time (CORBA::Float time)
35 char buf[50];
37 // Format value as a string
38 ACE_OS::sprintf (buf, "%6.3f", time);
40 // Convert to compound string
41 XmString xmstr = XmStringCreateSimple (buf);
43 // Display the string in the Label widget
44 XtVaSetValues (this->label_, XmNlabelString, xmstr, static_cast<void *>(0));
45 //??Can use XtSetValues with ac and al values..
47 // The compound string can be freed once passed to the widget
48 XmStringFree (xmstr);