librelist archives

« back to archive

newbie questions...

newbie questions...

From:
Chuck Remes
Date:
2011-09-12 @ 20:26
I just wrote my first app with Shoes. The design and implementation went 
very fast!

I do have a few questions though.

1. How can I set it so that hitting the TAB key in an edit_line element 
can advance the focus to the next edit_line element?

2. How can I set a button to be the default button? e.g. I have two 
buttons in a dialog where one is Cancel and the other is OK. How can I set
it so that hitting enter/return will always select the OK button *and* the
OK button shows up as the default choice (and displays correctly for each 
platform)?

3. Has anyone written a Date Picker widget that can be incorporated into 
Shoes applications? I'd like for a user to be able to click on a graphic 
of a calendar and it will pop up a miniature version of one where they can
increment/decrement months and click on days to select them.

4. I would like to incorporate some external gems in my sources. When 
running my application with the Shoes.app (OSX) it wasn't able to find & 
load my gem(s). I am assuming Shoes.app has a Ruby runtime built into it 
and it's not using the system Ruby or GEM_HOME to find gems. How can I get
that to work?

Thanks!

cr

Re: [shoes] newbie questions...

From:
Tobias Pfeiffer
Date:
2011-09-12 @ 20:36
I am short on time so:

1. I think there is an issue open on github for this (not sure)

4. Just ran into the same thing some days ago: 
http://pragtob.wordpress.com/2011/09/09/shoes-and-ruby-gems/

cheers,
Tobi

On 09/12/2011 10:26 PM, Chuck Remes wrote:
> I just wrote my first app with Shoes. The design and implementation went
very fast!
>
> I do have a few questions though.
>
> 1. How can I set it so that hitting the TAB key in an edit_line element 
can advance the focus to the next edit_line element?
>
> 2. How can I set a button to be the default button? e.g. I have two 
buttons in a dialog where one is Cancel and the other is OK. How can I set
it so that hitting enter/return will always select the OK button *and* the
OK button shows up as the default choice (and displays correctly for each 
platform)?
>
> 3. Has anyone written a Date Picker widget that can be incorporated into
Shoes applications? I'd like for a user to be able to click on a graphic 
of a calendar and it will pop up a miniature version of one where they can
increment/decrement months and click on days to select them.
>
> 4. I would like to incorporate some external gems in my sources. When 
running my application with the Shoes.app (OSX) it wasn't able to find&  
load my gem(s). I am assuming Shoes.app has a Ruby runtime built into it 
and it's not using the system Ruby or GEM_HOME to find gems. How can I get
that to work?
>
> Thanks!
>
> cr
>

Re: [shoes] newbie questions...

From:
Chuck Remes
Date:
2011-09-13 @ 14:36
On Sep 12, 2011, at 3:36 PM, Tobias Pfeiffer wrote:

> 4. Just ran into the same thing some days ago: 
> http://pragtob.wordpress.com/2011/09/09/shoes-and-ruby-gems/

I tried this on OSX using the latest release of Shoes. It told me it was 
installing the gem that I added ('uuid') but it froze at the end (spinning
beachball of death). On subsequent relaunches it did not try to install 
uuid again, but nor could it actually load that gem (LoadError in the 
console).


On Sep 13, 2011, at 2:17 AM, J. Kaiden wrote:

> On Mon, Sep 12, 2011 at 10:26 PM, Chuck Remes <cremes.devlist@mac.com> wrote:
> I just wrote my first app with Shoes. The design and implementation went
very fast!
> 
>   great!  isn't Shoes awesome?

Yes! It makes difficult things manageable.

> 
> 1. How can I set it so that hitting the TAB key in an edit_line element 
can advance the focus to the next edit_line element?
> 
>   hmm...  as i understand it, you don't have to set anything...  if you 
are entering text in an edit_line, and press TAB, you will advance to the 
next edit line - try it with this:
> 
>     Shoes.app do
>       el1 = edit_line
>       el2 = edit_line
>       el3 = edit_line
>     end

No, that doesn't work for me. For one, I need to click on the first edit 
line to give it focus. Hitting tab doesn't do it for me. Then after 
entering some text into the field, hitting tab merely highlights the text.
It does *not* advance to the next field.


On Sep 13, 2011, at 6:05 AM, ashbb wrote:

> Hi Chuck,
> 
> Thank you for the post and welcome to Shoes ML. ;-)

Thank you!

> At first, are you using Red Shoes on OSX, aren't you?

Yes. I am using the last released version from the shoesrb.com website. I 
see that someone posted a new build for OSX in another current thread so 
I'll probably download that and mess with it too.


> 1. I think this is the problem on OSX. I'm using Red Shoes 3 for Windows.
> The tabbing (move to next edit_line) works well in the following snippet.
> 
> Shoes.app do
>  3.times{edit_line}
> end

As I mention above, it doesn't work for me on OSX (10.6.8).

> 2. Look at focus() method: http://shoes.heroku.com/manual/Button.html#focus
> But, umm.... The following snippet doesn't work as expected on my Windows 7.
> I think this is a bug...
> 
> Shoes.app do
>  button('one'){alert 'one'}
>  button('two'){alert 'two'}.focus
>  button('three'){alert 'three'}
> end
> 
> ps. With Green Shoes, this snippet works well. ;-)

I tried running the code under Green Shoes. Apparently it doesn't have 
feature parity just yet. It blew up on a line where I set the app (and 
some sub-stacks) to use a width of "100%". It doesn't accept a percentage 
and demanded a Numeric. After I hardcoded the number of pixels, the 
program launched okay but the formatting did not match Red Shoes. Lastly, 
when I tried entering some text into a field (that does some work on the 
Change event) the program exited.

I can (and will) open up issues for these items. I'll do my best to 
include a small code reproduction for each one.


> 4. As Tobi noted, Shoes.setup is one of the ways.


Oh, it's only one of the ways? The method that Tobi posted didn't really 
work for me. What is an alternate mechanism for including gems?


Thanks to all of you for the quick and thorough responses. I very much 
appreciate it!

cr

Re: [shoes] newbie questions...

From:
Tobias Pfeiffer
Date:
2011-09-13 @ 14:44
ugh I dunno a thing about OSX I'm a linux guy :-) I know that shoes 
stores the gems in the ~/.shoes/+gem/gems directory (at least on 
Linux).. maybe look if it is present there, delete it if present and 
give it a new try?

Tobi

On 09/13/2011 04:36 PM, Chuck Remes wrote:
> On Sep 12, 2011, at 3:36 PM, Tobias Pfeiffer wrote:
>
> >  4. Just ran into the same thing some days ago:
> >  http://pragtob.wordpress.com/2011/09/09/shoes-and-ruby-gems/
>
> I tried this on OSX using the latest release of Shoes. It told me it was
> installing the gem that I added ('uuid') but it froze at the end (spinning
> beachball of death). On subsequent relaunches it did not try to install uuid
> again, but nor could it actually load that gem (LoadError in the console).
>
>
> On Sep 13, 2011, at 2:17 AM, J. Kaiden wrote:
>
> >  On Mon, Sep 12, 2011 at 10:26 PM, Chuck Remes<cremes.devlist@mac.com
> >  <mailto:cremes.devlist@mac.com>>  wrote:
> >
> >      I just wrote my first app with Shoes. The design and implementation went
> >      very fast!
> >
> >
> >  great! isn't Shoes awesome?
>
> Yes! It makes difficult things manageable.
>
> >
> >      1. How can I set it so that hitting the TAB key in an edit_line element
> >      can advance the focus to the next edit_line element?
> >
> >
> >  hmm... as i understand it, you don't have to set anything... if you are
> >  entering text in an edit_line, and press TAB, you will advance to the next
> >  edit line - try it with this:
> >
> >  Shoes.app do
> >  el1 = edit_line
> >  el2 = edit_line
> >  el3 = edit_line
> >  end
>
> No, that doesn't work for me. For one, I need to click on the first edit line to
> give it focus. Hitting tab doesn't do it for me. Then after entering some text
> into the field, hitting tab merely highlights the text. It does *not* advance to
> the next field.
>
>
> On Sep 13, 2011, at 6:05 AM, ashbb wrote:
>
> Hi Chuck,
>
> Thank you for the post and welcome to Shoes ML. ;-)
>
> Thank you!
>
> >  At first, are you using Red Shoes on OSX, aren't you?
>
> Yes. I am using the last released version from the shoesrb.com
> <http://shoesrb.com>  website. I see that someone posted a new build for OSX in
> another current thread so I'll probably download that and mess with it too.
>
>
> >  1. I think this is the problem on OSX. I'm using Red Shoes 3 for Windows.
> >  The tabbing (move to next edit_line) works well in the following snippet.
> >
> >  Shoes.app do
> >  3.times{edit_line}
> >  end
>
> As I mention above, it doesn't work for me on OSX (10.6.8).
>
> >  2. Look at focus() method: http://shoes.heroku.com/man ual/Button.html#focus
> >  <http://shoes.heroku.com/manual/Button.html#focus>
> >  But, umm.... The following snippet doesn't work as expected on my Windows 7.
> >  I think this is a bug...
> >
> >  Shoes.app do
> >  button('one'){alert 'one'}
> >  button('two'){alert 'two'}.focus
> >  button('three'){alert 'three'}
> >  end
> >
> >  ps. With Green Shoes, this snippet works well. ;-)
>
> I tried running the code under Green Shoes. Apparently it doesn't have feature
> parity just yet. It blew up on a line where I set the app (and some sub-stacks)
> to use a width of "100%". It doesn't accept a percentage and demanded a Numeric.
> After I hardcoded the number of pixels, the program launched okay but the
> formatting did not match Red Shoes. Lastly, when I tried entering some text into
> a field (that does some work on the Change event) the program exited.
>
> I can (and will) open up issues for these items. I'll do my best to include a
> small code reproduction for each one.
>
>
> >  4. As Tobi noted, Shoes.setup is one of the ways.
>
> Oh, it's only one of the ways? The method that Tobi posted didn't really work
> for me. What is an alternate mechanism for including gems?
>
>
> Thanks to all of you for the quick and thorough responses. I very much
> appreciate it!
>
> cr
>

Re: [shoes] newbie questions...

From:
Chuck Remes
Date:
2011-09-13 @ 15:29
On Sep 13, 2011, at 9:36 AM, Chuck Remes wrote:

> On Sep 13, 2011, at 2:17 AM, J. Kaiden wrote:
>> 1. How can I set it so that hitting the TAB key in an edit_line element
can advance the focus to the next edit_line element?
>> 
>>   hmm...  as i understand it, you don't have to set anything...  if you
are entering text in an edit_line, and press TAB, you will advance to the 
next edit line - try it with this:
>> 
>>     Shoes.app do
>>       el1 = edit_line
>>       el2 = edit_line
>>       el3 = edit_line
>>     end
> 
> No, that doesn't work for me. For one, I need to click on the first edit
line to give it focus. Hitting tab doesn't do it for me. Then after 
entering some text into the field, hitting tab merely highlights the text.
It does *not* advance to the next field.

I just tested this using Red Shoes release on Windows 7. It works as expected.

I also tested it under Green Shoes on Windows and it also works as expected.

Looks like it's just busted on OSX.


>> 4. As Tobi noted, Shoes.setup is one of the ways.
> 
> 
> Oh, it's only one of the ways? The method that Tobi posted didn't really
work for me. What is an alternate mechanism for including gems?

I deleted the ~/.shoes directory and relaunched my shoes program. It 
installed the appropriate gem, but it hung (spinning beachball) even 
though it said "finished installing uuid". I did a force quit on the 
application, relaunched, and now it appears to work.

Running the code under Windows installs the gem without error.

cr

Re: [shoes] newbie questions...

From:
J. Kaiden
Date:
2011-09-13 @ 07:17
On Mon, Sep 12, 2011 at 10:26 PM, Chuck Remes <cremes.devlist@mac.com>wrote:

> I just wrote my first app with Shoes. The design and implementation went
> very fast!
>

  great!  isn't Shoes awesome?



> 1. How can I set it so that hitting the TAB key in an edit_line element can
> advance the focus to the next edit_line element?
>


  hmm...  as i understand it, you don't have to set anything...  if you are
entering text in an edit_line, and press TAB, you will advance to the next
edit line - try it with this:

    Shoes.app do
      el1 = edit_line
      el2 = edit_line
      el3 = edit_line
    end


> 2. How can I set a button to be the default button?... How can I set it so
> that hitting enter/return will always select the OK button *and* the OK
> button shows up as the default choice (and displays correctly for each
> platform)?
>


  you could try something like this to capture the enter/return key:

    Shoes.app do

def ok_method
p "hey, that's ok"
end
 def cancel_method
p "that's not ok at all"
end
 b1 = button("ok"){ok_method}
b2 = button("cancel"){cancel_method}
 keypress do |k|
ok_method if k == "\n"
end
    end


  ...not sure about making it "look selected," have to fool around with
that...


> 3. Has anyone written a Date Picker widget that can be incorporated into
> Shoes applications?
>


  i haven't, but seems like it wouldn't be too hard to work out - here's a
link to some stuff about widgets...
https://github.com/lljk/shoes-stuff/wiki/Shoes-Widgets


  keep Shoesin'!

  - j

Re: [shoes] newbie questions...

From:
J. Kaiden
Date:
2011-09-13 @ 07:42
>
>
>> 2. How can I set a button to be the default button?... How can I set it so
>> that hitting enter/return will always select the OK button *and* the OK
>> button shows up as the default choice (and displays correctly for each
>> platform)?
>>
>
>
>   you could try something like this to capture the enter/return key:
>
>     Shoes.app do
>
> def ok_method
>  p "hey, that's ok"
> end
>  def cancel_method
> p "that's not ok at all"
> end
>  b1 = button("ok"){ok_method}
> b2 = button("cancel"){cancel_method}
>  keypress do |k|
> ok_method if k == "\n"
>  end
>     end
>


  hey again,

  was fooling with this more, and it turns out this isn't such a great way
to solve this problem - sorry!  if i can figure something better out i'll
certainly get back to you!

  - j

Re: [shoes] newbie questions...

From:
ashbb
Date:
2011-09-13 @ 11:05
Hi Chuck,

Thank you for the post and welcome to Shoes ML. ;-)

At first, are you using Red Shoes on OSX, aren't you?

1. I think this is the problem on OSX. I'm using Red Shoes 3 for Windows.
The tabbing (move to next edit_line) works well in the following snippet.

Shoes.app do
 3.times{edit_line}
end

2. Look at focus() method: http://shoes.heroku.com/manual/Button.html#focus
But, umm.... The following snippet doesn't work as expected on my Windows 7.
I think this is a bug...

Shoes.app do
 button('one'){alert 'one'}
 button('two'){alert 'two'}.focus
 button('three'){alert 'three'}
end

ps. With Green Shoes, this snippet works well. ;-)

3. Oh, good idea!
I don't know anyone write the Date Picker. But feel free write it by
yourself and share. ;-)

4. As Tobi noted, Shoes.setup is one of the ways.

Have fun,
ashbb