5 Replies Latest reply on Jan 9, 2014 5:14 AM by Ruben Ruben

    Trying to customize default menu prevents app from starting up.

    Ruben Ruben

      Hi,

       

      I'm trying to write a customized action for my default menu, but every time I try to do so, my app fails to start on my test device. Im on Rhodes 4.0, testing on a Samsung Galaxy S3 mini, running android 4.1.2.

       

      My application.rb:

       

      require 'rho/rhoapplication'

       

       

      class AppApplication < Rho::RhoApplication

        def initialize

          # Tab items are loaded left->right, @tabs[0] is leftmost tab in the tab-bar

          # Super must be called *after* settings @tabs!

          @tabs = nil

         

          #Remove default toolbar:

          @@toolbar = nil   

          super

       

       

          @default_menu = {

            "Main menu" => :home,

            "View Accounts" => url_for(:action => :show_test),

            "Do Refresh" => :refresh,

            "Perform Sync" => :sync,

            "App Options" => :options,

            "View Log" => :log

          }

          # Uncomment to set sync notification callback to /app/Settings/sync_notify.

          # Rho::RhoConnectClient.setObjectNotification("/app/Settings/sync_notify")

          Rho::RhoConnectClient.setNotification('*', "/app/Settings/sync_notify", '')

          #check for existence

          if Rho::RhoConfig.exists?('lang') && Rho::RhoConfig.lang != 'default'

            System::set_locale(Rho::RhoConfig.lang)

          else

            Rho::RhoConfig.lang = 'default'

            System::set_locale(Rho::System.locale + "_" + Rho::System.country)

          end

         

        end

       

        def show_test

          puts "Im here!"

          WebView.navigate '/app/Uurdet/test'

        end

       

      end

       

      The error it gives:

      Server Error

       

      Eror: uninitialized constant Rho::RhoController::Localization

      Trace:

      lib/rho/rho.rb:1295: in `const_missing`

      ... (continues with a pretty much useless trace)

       

      I use localization support, it has been working perfectly, but I don't know what it would have to do this setting a custom menu (which isnt even localized yet)

       

      Thanks for your time!