开发者

problem for cross plateform rhodes

开发者 https://www.devze.com 2023-02-19 16:07 出处:网络
i have made setup for the rhodes (cross platform) very well and i got the success in setup itself.with the \"$rake run:iphone\" command i can get the successful execution of demo project.Now i want to

i have made setup for the rhodes (cross platform) very well and i got the success in setup itself.with the "$rake run:iphone" command i can get the successful execution of demo project.Now i want to handle some issues like i want 开发者_JAVA百科to do arithmatic calculations in one screen and i want to show the answer in next screen. How would i get that? give the suggestions please?


I know that it is some time since you posted this, but I hope it helps or that others may find it helpfull.

Assuming that you know how to make the calculations on the first page, lets call it the index-page (as it is properly named in rhodes), you can do it as follows:

Before you begin make sure that you store the result of your calculations in a variable, for these instructions lets call it $result.

1) Create a new .erb file which you want to represent the result page (if you created a model, you already have a .erb file called "show" and could just as easily modify and use that). In this example - lets call the page "result".

2) Create a new def in your controller - lets call it "calculate". This could look something like this:

def calculate
[do any calulations you should desire]
$result = [result of calculations]
render :action => :result, :back => url_for(:action => :index)
end

This line:

render :action => :result, :back => url_for(:action => :index)

will send you to your result page and define the action for the smartphone's backbutton to navigate back to your index-page.

3) Make sure that your "get-result-button" on your index-page invokes your new def. For a simple link this could for example look something like this:

<a href="<%= url_for :action => :calculate %>">get result</a>

4) Display the result in the result page. Your variable from your index-page is still available in the result-page, so you can show the result by adding the following line to your result-page (result.erb):

<%= $result.to_s %> (this will insert your result as a string).

0

精彩评论

暂无评论...
验证码 换一张
取 消