apache / royale-asjs

Apache Royale ASJS
Apache License 2.0
374 stars 116 forks source link

mx:Text is not working with bindable value #955

Open pashminakazi opened 3 years ago

pashminakazi commented 3 years ago

If I am giving direct value to mx:Text it will work fine but it doesn't; works with binded value like it works with but it doesn't works with model.messageVO.message has a value which I tried to print in Alert and it is working fine but in mx:TextArea it is not working

aharui commented 3 years ago

Are there compiler warnings about not being able to detect changes to model.messageVO.message? Try making a simple test case.

alinakazi commented 3 years ago

Alex We are trying to migrate the Cairngorm from flex to Royale this time. We have a test case. I will upload it on GitHub and share link with you.

alinakazi commented 3 years ago

image

alinakazi commented 3 years ago

https://github.com/alinakazi/MigrationProjSamples

carlosrovira commented 3 years ago

@alinakazi I remember @greg-dove has a Cairngorm migrated version. He already shared in some email or issue some month ago (don't remember when or where)

alinakazi commented 3 years ago

We have prepared a separate lib for cairngorm migrated in Royale. It also compiled successfully. We are preparing a test using that library. It gives error where we Bind the mx:text with a model field. The error is in screenshot. I will try to find the thread where @greg-dove has discussed about it.

alinakazi commented 3 years ago

@carlosrovira @aharui does Crux has everything as Cairngorm had in Flex?

carlosrovira commented 3 years ago

No. Crux (old Swiz) was developed to respond to Cairngorm flaws, so Crux is a much easier and evolved framework. But Greg added to our Crux the cabability to call Cairngorm commands, so maybe that could make you to use Crux instead Cairngorm. But that's just a gues and no one better than @greg-dove to respond to that

greg-dove commented 3 years ago

@alinakazi I definitely used cairngorm already. I am really working crazy long hours for the next week. I will try to release it on github after that. But here are some downloads. https://www.dropbox.com/sh/xk8aui9ghy30mid/AAAAx0LUpfjXEQWC221zAjTza?dl=0

For that Chainbinding error. I do recall thinking in the past that this class needs attention in bindings but it was not something I worked on yet. You might be able to avoid that type of binding by reducing the 'depth' of your binding.

instead of {model.messageVO.message} which has 3 levels, try using {getMessage(model.messageVO)} with a private function getMessage(myVO:MessageVO):String{if (myVO) return myVO.message else return ''} in the script block of the mxml. Just a suggestion... it might not work if the message part needs to be bindable, but often this is not the case for a class named 'VO'

greg-dove commented 3 years ago

actually there could also be a problem with that binding if 'model' is not a typed reference. If model is typed as Object, then it would be best to avoid that and add a specific getter that returns the model as a specific type (Class) so the compiler knows. Again, not sure ... just adding a comment for you to investigate for now.

aharui commented 3 years ago

The example did not seem complete.

alinakazi commented 3 years ago

@greg-dove {getMessage(model.messageVO)} with a private function getMessage(myVO:MessageVO):String{if (myVO) return myVO.message else return ''} this works for us. Thanks

alinakazi commented 3 years ago

@aharui Alex the example i shared or Greg has shared?

aharui commented 3 years ago

The one you shared. It seemed to reference views that weren't in the example source. Or maybe I just missed it.

alinakazi commented 3 years ago

These views are in the library project.