Editing Blackberry application menu

With CSS you can easily modify you screen layout and make powerful intutive application.

But to modify the phone menu – specifically for Black Berry & Android devices, Rhodes provide following easy API’s :

@default_menu = { 
"Item Label 1" => "/item1path",
"Item Label 2" => "/item2path",
.
.
. 
}
@menu = { 
"Item Label 1" => "/item1path",
"Item Label 2" => "/item2path",
.
.
.  
}
Default Menu
This is the BB/Android by default menu, any changes made in this api will refect across all pages of your application. 




Following changes are made in application.rb placed in your rhodes applications /app folder. 




Example :
class AppApplication < Rho::RhoApplication
def initialize
super
@default_menu = {
"Go Home" => :home,
"View Accounts" => "/app/Account", #Depending on your app specific action can be specified "Do Refresh" => :refresh,
"Perform Sync" => :sync,
"App Options" => :options,
"View Log" => :log, :separator => nil, "Exit" => :close
}
end
end
Clicking your BB menu button will open up following list :
Go HomeView AccountsDo RefreshPerformance SyncApp OptionView Log Exit







Menu -In case your application has specific menu for each and every page, you have use Menu api.
Following changes are made in your application controller, each menu can be tailored according to specific action. def index
@accounts = Account.find(:all)
@menu = {
"Go Home" => :home,
"Refresh" => :refresh,
"Options" => :options,
:separator => nil,
"Log" => :log,
"New Account" => "/app/Account/new"
}
render
end
Following menu will be rendered on index page of your application :Go HomeRefreshOptions LogNew Account








Note : Above menu is only for Index page, rest all the pages will render the Default_Menu.
Layouts, CSS, Javascript framework, Native toolbar control, native tabbar control

Share

Leave a Comment

Your email address will not be published. Required fields are marked *