Jump to content

align="expand" for WidgetLabel


photo

Recommended Posts

Posted

I have next ui-file:

 

<?xml version="1.0" encoding="utf-8"?>
<ui version="1.0">

<!-- Определяет диалог с пользователем -->
<vbox name="Source::TextPanel::mainPanel" export="1">
	<sprite align="background" texture="source/textures/game/gui/text_panel.png"/>
	<vbox align="overlap,expand" space="8">
		<label align="expand" name="Source::TextPanel::captionLabel" export="1">
			<text rich="1">
				<p align="center">Paragraph</p>
				<p align="left">This is a main text, it's descibe some game situatuin</p>
			</text>
		</label>
		<hspacer align="expand"/>
		<hbox>
			<icon name="Source::TextPanel::prevPageButton" export="1"
				width="42" height="42" texture="source/textures/game/gui/item_rose.png">
				<callback type="clicked">Source::TextPanel::eventPrevButtonClick</callback>
			</icon>
			<vbox>
			</vbox>
		    <icon name="Source::TextPanel::nextPageButton" export="1"
		    	texture="source/textures/game/gui/item_whistle.png">
		      <callback type="clicked">Source::TextPanel::eventNextButtonClick</callback>
		    </icon>
		</hbox>
	</vbox>
</vbox>

</ui>

 

This is looks good, but text in label output in one line and go out from my panel.

Then I use next code line to fix this:

captionLabel.setFontWrap(true);

Then text place in all size of my panel, but in few moments it reduse his width:

post-151-0-10616500-1295016096_thumb.jpg

post-151-0-53933100-1295016102_thumb.jpg

I check my update methods - they do not address to widget elements and do not change their properties.

Posted

You should set width of vbox container. In your example vbox don't know about size of text_panel sprite. And because of this vbox shrinks to minimal text size.

 

<vbox align="overlap" space="8" width="320">

×
×
  • Create New...