Page 1 of 1

[Bug]ControlClasses not working

Posted: 06 Aug 2014, 01:12
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.

Re: [Bug]ControlClasses not working

Posted: 06 Aug 2014, 07:35
by magnetik
We are using the classes in different places without problems. What is the associated ManiaLink?

Re: [Bug]ControlClasses not working

Posted: 06 Aug 2014, 11:08
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.

Re: [Bug]ControlClasses not working

Posted: 06 Aug 2014, 12:30
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>