I've posted a fix for you at http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=7250

I think the issue revolves around a view being created with certain text, versus having its text set through a constraint.  In the first case it will be sized based on the text it contains.  In the second case I think it will get a default size, which will not change when the constraint is applied.  Setting resize=true in the text fixes the problem.

Medovárszky Zoltán wrote:

Hi,


I would like to create a simple text menuover class without success. If I define it with a class, the width and alignment is bad. I've tried for several hours...

Thanks for any suggestions.


This works:

<?xml version="1.0" encoding="UTF-8" ?> 
<canvas width="955" height="600">
<splash/>
<view id="view_main_topmenu">
	<view width="${felirattext.width+20}">
		<text name="felirattext" align="center" fontsize="10" fontstyle="bold" fgcolor="0x666666">
			about us
			<handler name="onmouseover">
				this.setColor(0xFFFFFF);
				parent.setAttribute('bgcolor','0x666666');;
			</handler>
			<handler name="onmouseout">
				this.setColor(0x666666);
				parent.setAttribute('bgcolor', null);;
			</handler>
		</text>
	</view>
</view>
</canvas>


this doesn't:

<?xml version="1.0" encoding="UTF-8" ?> 
<canvas width="955" height="600">
<splash/>
<include href=""/>
<view id="view_main_topmenu">
	<TopmenuButton menutext="about us"/>
</view>
</canvas>


  
classlib.lzx :
<library>
	<class name="TopmenuButton">
		<attribute name="menutext" type="string"/>
		<view width="${sometext.width+20}">
			<text width="100%" name="sometext" text="${classroot.menutext}" align="center" fontsize="10" fontstyle="bold" fgcolor="0x666666">
				<handler name="onmouseover">
					this.setColor(0xFFFFFF);
					parent.setAttribute('bgcolor','0x666666');;
				</handler>
				<handler name="onmouseout">
					this.setColor(0x666666);
					parent.setAttribute('bgcolor', null);;
				</handler>
			</text>
		</view>
	</class>
</library>

  

_______________________________________________ Laszlo-dev mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

-- 
Jason Stafford
Principal Developer
Inspiration Software, Inc.
The leader in visual thinking & learning

InspireData(tm), the newest innovative thinking and learning tool from
Inspiration Software(r), extends the proven power of visual learning to
data analysis. Learn more at www.inspiration.com. 

503-297-3004 Extension 119
503-297-4676 (Fax)
9400 SW Beaverton-Hillsdale Highway
Suite 300
Beaverton, OR 97005-3300
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to