[Bug]ControlClasses not working

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
Banane9
Posts: 8
Joined: 17 Aug 2012, 11:12
Contact:

[Bug]ControlClasses not working

Post by Banane9 »

Hello, when working on a Manialink today (yesterday by now...), I encountered a Problem with the classes set in the class Attribute not being available when running the script. I.e. at execution time, the ControlClasses Array was empty, and the HasClass method returned false, even if the specified class was in the XML. My ManiaScript code is:

Code: Select all

declare CMlFrame search <=> (Page.GetFirstChild("Search") as CMlFrame);
foreach(control in search.Controls)
{
	// This never executes, as HasClass always Returns false, and ControlClasses is empty.
	if (control.HasClass("searchEntry"))
	{
		declare CMlEntry searchEntry <=> ((control as CMlFrame).GetFirstChild("entry") as CMlEntry);
		searchEntry.Value = control.ControlId;
	}
}
I tried it for elements in the same file, and in an included file.

My Client Version should be the latest, as there's no update request on start.
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: [Bug]ControlClasses not working

Post by magnetik »

We are using the classes in different places without problems. What is the associated ManiaLink?
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
User avatar
Banane9
Posts: 8
Joined: 17 Aug 2012, 11:12
Contact:

Re: [Bug]ControlClasses not working

Post by Banane9 »

The Manialink code is:

Code: Select all

<frame posn="3 -77 0" id="Search" hidden="1">
	<format focusareacolor1="fff0" focusareacolor2="fff0" bgcolor="ccc" textcolor="000"/>
	
	<framemodel id="searchInput">
		<quad posn="0 0 0" sizen="50 8"/>
		<entry posn="1.5 -1.5 1" sizen="47 6" id="entry" ScriptEvents="1"/>
	</framemodel>
	
	<frameinstance modelid="searchInput" id="Name" class="searchEntry"/>
	<frameinstance posn="0 -10 0" modelid="searchInput" id="Autor" class="searchEntry"/>
	<frameinstance posn="0 -20 0" modelid="searchInput" id="Environments" class="searchEntry"/>
	<frameinstance posn="0 -30 0" modelid="searchInput" id="Styles" class="searchEntry"/>
</frame>
However, I tried changing the fraeinstance-s to quad, but it still didn't have the classes.
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: [Bug]ControlClasses not working

Post by magnetik »

You have to put the class on the framemodel:

Code: Select all

       <framemodel id="searchInput" class="searchEntry">
          <quad posn="0 0 0" sizen="50 8"/>
          <entry posn="1.5 -1.5 1" sizen="47 6" id="entry" ScriptEvents="1"/>
       </framemodel>
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest