librelist archives

« back to archive

First Question

First Question

From:
Kc Erb
Date:
2013-07-08 @ 16:10
Hi all,

I'm fairly new to Shoes and Ruby and so far have been able to answer all of
my questions via study, experiment, and stack-overflow. This latest problem
however has been getting stickier the deeper I go. Thanks in advance for
any help / time spent.

I have a list of names that I want to be clickable. I don't want the names
to look like links and when I tried para link . . . , :stroke => white ,etc
the link formatting dominated (i.e. it stayed underlined and blue).

So my next attempt was using para's :click setting. I expected the
following to work but none of the variants I tried would work:

alert_proc = Proc.new { alert "You clicked para" }

para "Click me", :click => alert_proc


Right now I'm putting each para in it's own stack and making the stacks
clickable. That works, but getting the stack spacing right is really hard
since stacks don't automatically fix their width to their content. The
problem I'm having here is telling the program to draw the stacks first,
get the widths of the paras, and then redraw the stacks. Since each name
stack is inside of an each loop it doesn't draw them until it has finished
the loop. I started contemplating how I would have shoes draw all of the
stacks, and then traverse them one by one finding the width of each para,
and resizing the stack and that's when I decided to get some help.

Any ideas?


-KC Erb

Re: [shoes] First Question

From:
Arne Brasseur
Date:
2013-07-08 @ 20:08
Hi Eric,

Welcome to Shoes! Which version are you using?

Thanks,
Arne
On 08 Jul 2013 18:10, "KC Erb" <iamkcerb@gmail.com> wrote:

> Hi all,
>
> I'm fairly new to Shoes and Ruby and so far have been able to answer all
> of my questions via study, experiment, and stack-overflow. This latest
> problem however has been getting stickier the deeper I go. Thanks in
> advance for any help / time spent.
>
> I have a list of names that I want to be clickable. I don't want the names
> to look like links and when I tried para link . . . , :stroke => white ,etc
> the link formatting dominated (i.e. it stayed underlined and blue).
>
> So my next attempt was using para's :click setting. I expected the
> following to work but none of the variants I tried would work:
>
> alert_proc = Proc.new { alert "You clicked para" }
>
> para "Click me", :click => alert_proc
>
>
> Right now I'm putting each para in it's own stack and making the stacks
> clickable. That works, but getting the stack spacing right is really hard
> since stacks don't automatically fix their width to their content. The
> problem I'm having here is telling the program to draw the stacks first,
> get the widths of the paras, and then redraw the stacks. Since each name
> stack is inside of an each loop it doesn't draw them until it has finished
> the loop. I started contemplating how I would have shoes draw all of the
> stacks, and then traverse them one by one finding the width of each para,
> and resizing the stack and that's when I decided to get some help.
>
> Any ideas?
>
>
> -KC Erb
>
>

Re: [shoes] First Question

From:
ashbb
Date:
2013-07-08 @ 21:25
Hi KC Erb,

Welcom to Shoes! Thanks for the question.
Could you show us the code you have in trouble?

Regards,
ashbb