[Plib-users] Problem with setLabel, weirdness ensues.
Brought to you by:
sjbaker
From: cory b. <co...@gm...> - 2008-06-11 19:28:06
|
I am trying to use the the set label command: and I am having weird problems. something like this works: puObject->setLabel( "label" ); this fails: char txt[ PUSTRING_MAX ]; ... //kp slider kp_slider = new puSlider ( 100, 60, 200, TRUE ); kp_slider->setMinValue( GAIN_MIN ); kp_slider->setMaxValue( GAIN_MAX ); kp_slider->setValue( ( float ) aileron_pid->get_kp() ); //set value to aileron gains since roll is selected by default sprintf( txt, "Kp: %.3f", aileron_pid->get_kp() ); //format label kp_slider->setLabel( txt ); the label comes out like: *****>*****0****** ***** but I can make it work by adding an unused variable?! this works: //unused variable bbb char bbb[ PUSTRING_MAX ]; //if I remove this setLabel() fails! char txt[ PUSTRING_MAX ]; ... //kp slider kp_slider = new puSlider ( 100, 60, 200, TRUE ); kp_slider->setMinValue( GAIN_MIN ); kp_slider->setMaxValue( GAIN_MAX ); kp_slider->setValue( ( float ) aileron_pid->get_kp() ); //set value to aileron gains since roll is selected by default sprintf( txt, "Kp: %.3f", aileron_pid->get_kp() ); //format label kp_slider->setLabel( txt ); I also cannot set the label in the callback function. Please help. Cory |