Calculating with TabBar

I want to make a calculation with the values from one view and switch then to a other view to show the results.

First I used a Button, but then I mean a TabBar looks nicer and I tried it.

I used the TabBar for switching the views. Then I used the deactivate event from the calculation view for do the calculation. The activate event form the result view is for getting the result values. But the activate event from the result view fires first and the deactivate event from the calculation view second. This means I get first the results of the former calculation and then the actual calculation is done. I need something to do it in the other way, first calculating, then result showing.

Somebody a idea for my problem?

Regards
Jens

[quote=153611:@Jens Holloch]I want to make a calculation with the values from one view and switch then to a other view to show the results.

First I used a Button, but then I mean a TabBar looks nicer and I tried it.

I used the TabBar for switching the views. Then I used the deactivate event from the calculation view for do the calculation. The activate event form the result view is for getting the result values. But the activate event from the result view fires first and the deactivate event from the calculation view second. This means I get first the results of the former calculation and then the actual calculation is done. I need something to do it in the other way, first calculating, then result showing.

Somebody a idea for my problem?[/quote]

Why don’t you put the result of your calculation in a module variable ? I just checked, setting one in deactivate and reading in activate of the other view works.

Alternatively, you may want to use an App property.

For some reason, it seems a view does not have access to another tabbed view (an existing one, not a pushed one), nor to a screen property (iPhoneScreen for instance). In both cases, it errors with item unknown.

Thanks for your reply. To get the results from one view to the other view is not the problem.
Here is the problem:
I want to start the calculation from the calculation view by clicking on the TabBar icon. Then I didn’t need a button to start the calculation anymore. But the TabBar have no action event, it only switches to the other view. So I tried to use the deactivation event as action event to start the calculation in one view. And I tried to use the activation event from the other view to get the results. Getting the result works, but I get first the results (of an older calculation) and then the calculation is starting. The reason is first starting the activate event and the deactivate event, wrong order.

[quote=153630:@Jens Holloch]Thanks for your reply. To get the results from one view to the other view is not the problem.
Here is the problem:
I want to start the calculation from the calculation view by clicking on the TabBar icon. Then I didn’t need a button to start the calculation anymore. But the TabBar have no action event, it only switches to the other view. So I tried to use the deactivation event as action event to start the calculation in one view. And I tried to use the activation event from the other view to get the results. Getting the result works, but I get first the results (of an older calculation) and then the calculation is starting. The reason is first starting the activate event and the deactivate event, wrong order.[/quote]

Never expect events to fire in any order. To obtain things in a precise order, use timers.

You could define a property of type iOSView and assign the “Calculate” view to this property. Then in the activate event of your “Result” view, you can use the property to access the public methods, properties, etc of the “Calculate” view.

Is the calculation too heavy to fire and store as the values change in the 1st view?

Then the 2nd view will always be able to read the latest result calculated in the 1st view when activated.