props.scene.find

4 views
Skip to first unread message

frpaulas

unread,
Nov 23, 2009, 8:51:38 AM11/23/09
to limelight
I don't understand the following behavior...
when my props.rb is...

__ :name => "screen"
buttons do
newdate :text => "New", :width => "25%"
thisweek :text => "This Week", :width => "75%"
end
display :id => "display", :text => "Welcome"

and players file newdate.rb is...

def self.extended(prop)
prop.display = prop.scene.find("display")
#prop.display.text = "WHAT"
puts "PROP nil?: #{prop.display.nil?}"
end

prop.display.nil? yields true
but when the props.rb is...

__ :name => "screen"
display :id => "display", :text => "Welcome"
buttons do
newdate :text => "New", :width => "25%"
thisweek :text => "This Week", :width => "75%"
end

prop.display.nil? yields false.
I would have expected both to yield false.
what am I missing?

Thanks for your help
Paul+

Eric Meyer

unread,
Nov 23, 2009, 11:46:58 AM11/23/09
to limelig...@googlegroups.com
The reason the display is nil the first time is because the new_date prop is being built on the screen before the display.  In the second version of the props.rb file, the display is already on the screen when the new_date prop gets extended.

Also, what is the reasoning behind using self.extended?

Eric

Paul Sutcliffe

unread,
Nov 24, 2009, 10:19:10 AM11/24/09
to limelig...@googlegroups.com

On Nov 23, 2009, at 11:46 AM, Eric Meyer wrote:

> The reason the display is nil the first time is because the new_date prop is being built on the screen before the display. In the second version of the props.rb file, the display is already on the screen when the new_date prop gets extended.
>
> Also, what is the reasoning behind using self.extended?

OK, I think I get that.

The reason for the self.extended: I wanted to click on a button and change the content of another existing prop.

Clearly I am floundering around here, but I see great utility here in Limelight, so I am anxious to figure it all out.

grace and peace
Paul+




Eric Meyer

unread,
Nov 24, 2009, 10:47:01 AM11/24/09
to limelig...@googlegroups.com
To do this, you need to implement the button_pressed or mouse_clicked method on the player you are clicking.  You use button_pressed if it's a prop with the player of button.  Otherwise, you use mouse_clicked.

module Newdate
  def mouse_clicked(event)
    scene.find("display").text = "New Text"
  end
end

If you look at the Limelight Docs Production, the players walkthroughs might give you more info.  There is also a section in the RDoc for the Button module.  (Limelight::Builtin::Players::Button)

Eric

Paul Sutcliffe

unread,
Nov 25, 2009, 8:47:59 AM11/25/09
to limelig...@googlegroups.com

On Nov 24, 2009, at 10:47 AM, Eric Meyer wrote:

> module Newdate
> def mouse_clicked(event)
> scene.find("display").text = "New Text"
> end
> end


I will SWEAR that was the first thing I tried and would get nil for the find, but I tried it again and it works fine.
MANY thanks!

On another topic: can the output interpret textile if I require redcloth (or similar)?

grace and peace
Paul+




Micah Martin

unread,
Nov 25, 2009, 2:06:08 PM11/25/09
to limelig...@googlegroups.com
Hi Paul,

No, neither textile nor redcloth are supported. But that's an interesting idea. We'll think about it.

Micah
Reply all
Reply to author
Forward
0 new messages