Shoes Experts - Can someone explain this

I have been practicing with Shoes and currently enjoying it.

I came across this code…

Shoes.app :width => 400, :height => 260 do
flow do
@e = edit_line
button “Say it” do
@p.clear { para @e.text }
end
end

@p = flow
end

but then I started wondering why the @p.clear { para @e.text } and the
@p = flow
why not just…

Shoes.app :width => 400, :height => 260 do
flow do
@e = edit_line
button “Say it” do
para @e.text
end
end
end

can someone explain this please?

Thanks a lot!

If you use both what is the difference?

My guess is that it is cleaning up the canvas where the text is written
(not an expert)

Hi Fily, Richard and folks,

I have been practicing with Shoes and currently enjoying it.
Wow, glad to hear that. Thanks for the post. :slight_smile:

As you know, the two snippets have different behaviors.

When you click the “Say it” button twice,

  • in case of first snippet,
    the text in the @p flow will be replaced.
    You’ll see just one line.

  • in case of second snippet,
    the text of @e.text will be appended.
    You’ll see two lines.

If you want to get the same behavior, try out the following.

Shoes.app :width => 400, :height => 260 do
flow do
@e = edit_line
button “Say it” do
@p.text = @e.text
end
end
@p = para
end

You’ll see just one line even if you click the button many times.

Hope this helps,
ashbb

On Fri, Jan 6, 2012 at 8:45 AM, Fily S. [email protected] wrote:

Is it ok to ask questions about Shoes in here?

i dont think 90% of the ruby-talkers would mind, but we also have a
shoes
mailing list, just send an email to [email protected] to join (the
archives are here: http://librelist.com/browser/shoes/ ) and we can
answer
all your shoes-specific Q’s there!!
take care!
hex

  • my blog is cooler than yours: http://serialhex.github.com
  • The wise man said: “Never argue with an idiot. They bring you down to
    their level and beat you with experience.”
  • As a programmer, it is your job to put yourself out of business. What
    you do today can be automated tomorrow. ~Doug McIlroy
    No snowflake in an avalanche ever feels responsible.

CFO: What happens if we train people and they leave?
CTO: What if we dont and they stay?

Hi Fily,

Is it ok to ask questions about Shoes in here?
Yes, of course.
But in Shoes ML (http://librelist.com/browser/shoes/), you may get
replies
quickly. :wink:

Cheers,
ashbb

I’m already subscribed to that mailing list but I don’t fully understand
how that mailing list works.

It doesn’t reflect the changes immediately, in other words if I ask
something and someone responds I get an e-mail but if I go to the
mailing list to see the full thread it doesn’t reflect the most recent
posts. I know I shouldn’t rely on what the mailing list shows just on
the emails I get but do I need to keep all of the email I sent and
receive?

I’m getting an e-mail every time some else asks or responds to other
threads and most of the time I use my phone to check my mail and my data
plan is only 200mb :frowning:

Why is this mailing list so different than the one used by HERE?

Sorry for the off-topic here.

— WOW I LIKE THIS @serialhex --------

  • my blog is cooler than yours: http://serialhex.github.com
  • The wise man said: “Never argue with an idiot. They bring you down to
    their level and beat you with experience.”
  • As a programmer, it is your job to put yourself out of business. What
    you do today can be automated tomorrow. ~Doug McIlroy
    No snowflake in an avalanche ever feels responsible.

CFO: What happens if we train people and they leave?
CTO: What if we dont and they stay?

Thanks a lot for the clarification! Make sense now

Is it ok to ask questions about Shoes in here?

Thanks a lot

Hi Fily,

Librelist is a free mailing list. Although it doesn’t reflect the
changes
immediately, there is almost no spams. So, we shoesers decided to live
there. Please be patient. :slight_smile:

ashbb

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs