controller view communications

22 views
Skip to first unread message

Payman Rezania

unread,
Oct 11, 2012, 8:21:18 AM10/11/12
to swiz-fr...@googlegroups.com
I have an app with an Admin view. It has two views in it which are shown by setting their visible attributes. View1 allows the user to fill in a form then sends the content of the form as an event which is handled in the controller. The controller communicates with the server and this is where the issue lies. When the service call is completed, I want the controller to communicate with the Admin view which makes view1 visible=false and view2 visible=true.

Im firing an even from the controller which should get handled in the AdminView but its not...Am I seeing this right or an I missing something?

Please help... 

Matias Gutierrez

unread,
Oct 11, 2012, 8:26:19 AM10/11/12
to swiz-fr...@googlegroups.com
Can you send some code?
What i do when i want to change from one view to another a just use ViewStack.
This helps.



2012/10/11 Payman Rezania <m...@dubnet.co.uk>
I have an app with an Admin view. It has two views in it which are shown by setting their visible attributes. View1 allows the user to fill in a form then sends the content of the form as an event which is handled in the controller. The controller communicates with the server and this is where the issue lies. When the service call is completed, I want the controller to communicate with the Admin view which makes view1 visible=false and view2 visible=true.

Im firing an even from the controller which should get handled in the AdminView but its not...Am I seeing this right or an I missing something?

Please help... 

--
You received this message because you are subscribed to the Google Groups "Swiz Framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/swiz-framework/-/E_a1uw_u-wUJ.
To post to this group, send email to swiz-fr...@googlegroups.com.
To unsubscribe from this group, send email to swiz-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swiz-framework?hl=en.



--
Matias Gutierrez

Brian Kotek

unread,
Oct 11, 2012, 8:27:04 AM10/11/12
to swiz-fr...@googlegroups.com
Sounds like you want to inject the Swiz Dispatcher and use it to dispatch the event, then handle it in the other controller (with a method decorated by [EventHandler]).

--

Payman Rezania

unread,
Oct 11, 2012, 9:04:20 AM10/11/12
to swiz-fr...@googlegroups.com
Hi Brian

I use the Swiz Dispatcher to dipatch an event and its being caught by the view. The view then tries to set the visible property of view1 but there is a runtime error as view1 is null.

Brian Kotek

unread,
Oct 11, 2012, 9:07:58 AM10/11/12
to swiz-fr...@googlegroups.com
Then it sounds like Swiz is working just fine and the problem is in how you're setting up or using your view(s).


To view this discussion on the web visit https://groups.google.com/d/msg/swiz-framework/-/0L_sm4YNdYIJ.

Payman Rezania

unread,
Oct 11, 2012, 9:20:12 AM10/11/12
to swiz-fr...@googlegroups.com, matias.g...@workants.com.ar
Hi Matias

I have attached the code.

The app is a TabbedViewNavigatorApplication which defines one view views.admin.TTiMobileAdminHomeView.

In that view there are 3 views:

views.admin.TTiMobileAdminProjectsMenuView
views.admin.TTiMobileAdminProjectsView
views.admin.TTiMobileAdminNewProjectView

They are handled by setting their visible properties ie the TTiMobileAdminProjectsMenuView has a list click handler which looks to its parentDocument (which is TTiMobileAdminHomeView) to fire the relevant functions. This is not the most elegant way of doing things and I would appreciate pointers here to make this better.

The issue is that TTiMobileAdminNewProjectView fires an event which is handled in the AdminController.as - This works fine - it communicates with the service and returns good. I want to some how get to the functions in the TTiMobileAdminHomeView to get the relevant view ie fire its viewProjectsView function. Ive tried this by sending an event from the controller which is caught by TTiMobileAdminHomeView but then it causes a runtime error as newView (which is the id for TTiMobileAdminNewProjectView) is null.

I may be doing things all wrong so your hep is appreciated...

Payman Rezania

unread,
Oct 11, 2012, 9:22:23 AM10/11/12
to swiz-fr...@googlegroups.com
sure thing - but if you can help then it would be greatly appreciated. Maybe Im not using the views correctly or there is another way of achieving what Im trying to do. Ive attached the code so if you run it you will see the runtime error after creating a new project

Brian Kotek

unread,
Oct 11, 2012, 9:27:51 AM10/11/12
to swiz-fr...@googlegroups.com
Sorry. If you have a specific question related to Swiz, I'm happy to try and help. But I don't have time to debug your project or do a design review for you. You might try asking on the flexcoders mailing list.


To view this discussion on the web visit https://groups.google.com/d/msg/swiz-framework/-/reND1jdt-mgJ.
Reply all
Reply to author
Forward
0 new messages