${CALL.method()} in a controldefinition

Hey guys,



I am in trouble once again. I made a control that types text on screen, but I am in trouble because I can’t get any text from outside the control.

Basically I want to use ${CALL.test()} syntax to get some custom text in my effect that is used in the control, but right now it doesn’t seem to work.

It works fine when I use it outside of the control definition.



Do you guys know some solution for it?



Basically it’s a form like:



Name: ${CALL.getName()}

Age: ${CALL.getAge()}

etc.



[xml]

<controlDefinition name=“progressbar” controller=“testp.MenuControl”>

<panel childLayout=“horizontal”>

<text visible=“false” id=“massData” style=“textFont” >

<effect>

<onCustom name=“test” length=“10000” startDelay=“2000” text="${CALL.test()}"/>

</effect>

</text>

</panel>

</controlDefinition>

[/xml]

Wow…

Now that I have had my first impact with nifty I suddenly feel bad and also good…

The thing is I spent hours and hours developing a control and now that I almost got it I ran into trouble, retought my strategy, did all from scratch without any control so far and I got the same work done in half an hour and with lots and lots fewer lines of code…



Still that method calling from controlDefinition interests me.

looks like a bug :slight_smile: can you post that on the sf.net nifty bug tracker please? thanks!

Will do when I find it :slight_smile:

Another question that arose while using nifty - aren’t there any better ways to get dynamic text content on the screen than having get methods in the controller?



I would like to have a model object that contains my information, and I would like to use something like ${CALL.getModel().getName()}

Or better yet, I would like to have things like:



[xml]

<screen id=“start” controller=“test.MenuControl” model=“getModel()”> <!-- where getModel is a method for the controller -->

<text text="${MODEL.getName()}" /> <!-- MODEL represents the data model I asked from the controller–>

<text text="${CALL.add(2,2)}" />

[/xml]



Without such things I see the controller code going really dirty really fast - or is there already a way to use methods that come from JavaBean class?

no, there is no java beans binding available for nifty >_<



the 1.3 standard controls will have a better API to access labels and text from java tho so the prefered way now would be to update the elements directly from java.