2 questions about progress bar
Posted: Mon Aug 22, 2011 18:16
I want to use a couple of progress bars to show hp and mana in my game, but I found two problems: the progress bars jumps from full to empty when I call setProgress() and neither can set a tooltip to figure out the current value. Here is my layout definition:
Here is the code that sets progress percent:
As you can see, I have tried two ways to set the tooltip, none works. Any idea?
Code: Select all
<Window Type="TaharezLook/ProgressBar" Name="MsgWin/hpbar" >
<Property Name="StepSize" Value="0.01" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="CurrentProgress" Value="0" />
<Property Name="UnifiedAreaRect" Value="{{0.0207031,0},{0.625013,0},{0.230664,0},{0.875013,0}}" />
</Window>
<Window Type="TaharezLook/ProgressBar" Name="MsgWin/mpbar" >
<Property Name="StepSize" Value="0.01" />
<Property Name="InheritsAlpha" Value="False" />
<Property Name="CurrentProgress" Value="0" />
<Property Name="UnifiedAreaRect" Value="{{0.770898,0},{0.636011,0},{0.980859,0},{0.886011,0}}" />
</Window>
Here is the code that sets progress percent:
Code: Select all
float perc = test->hp/test->hpmax;
hp->setProgress(perc);
//hp->setTooltipText(StringConverter::toString(test->hp)+"/"+StringConverter::toString(test->hpmax));
hp->setProperty("Tooltip",StringConverter::toString(test->hp)+"/"+StringConverter::toString(test->hpmax));
As you can see, I have tried two ways to set the tooltip, none works. Any idea?