Class: __NAME__View

Inherits:
ApplicationView
  • Object
show all
Defined in:
lib/templates/basic/basic_view.rb

Overview

This is our Monkeybars View code

Instance Method Summary collapse

Instance Method Details

#handle_new_text(model, transfer) ⇒ Object

This is the method invoked when the view receives the set_new_text signal is received. All such signal handlers need to accept model and transfer objects.

To understand Moneybars signals, see:

http://www.jimpanzee.org/understanding-signals


31
32
33
# File 'lib/templates/basic/basic_view.rb', line 31

def handle_new_text model, transfer
  default_label.text = transfer[:new_text]
end

#loadObject

@load@ is called when the UI is opened. You can think of it as a subsitute for ‘initialize’, which, in the parent code, is already used for high-lelve preperations and should not be replaced without a good understanding of how it works.

To understand the Monkeybars View lifecycle, see:

http://www.jimpanzee.org/understanding-views


18
19
20
21
22
23
24
# File 'lib/templates/basic/basic_view.rb', line 18

def load
  # Helper method defined in application_view ro all views can use it
  set_frame_icon 'images/mb_default_icon_16x16.png'
  move_to_center # Built in to each Monkeybars View class.
  # Set up some basics content for our UI ...
  default_label.text = "Monkeybars is the bomb!"
end