librelist archives

« back to archive

Removal of focus from objects

Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-21 @ 21:36
Essentially I'm building a program that has a a bunch of widgets - 
buttons, list_boxes etc - and I'm trying to use key commands to move 
around a grid of drawn rectangles. 

I.e I have a square that is drawn on top of the grid in another colour and
is moved by the rect.move command. The problem arises when I click a 
button, or a list_box and the object steals the focus from the window, and
I'm left with the inability to move the square via the wasd keys!

Is there a way to remove focus, or reset it to the window? 

Alternatively, is there a way to add click objects to rectangles, so that 
I can just change the stroke colours? 

Cheers,
Stuart

Re: [shoes] Removal of focus from objects

From:
J. Kaiden
Date:
2013-01-21 @ 23:16
hi Stuart,

  i think there is a way to set the focus on particular widgets after
events (the button and edit_box both have :focus methods,) but i don't
think you need to go that far.

  you can definitely call the :click method on a rectangle and ask it
(nicely) to change it's stroke color, or anything else you'd like.

  for some reason, i can't copy and paste this snippet as a github gist
(and i'm too lazy to retype it!)  - so i'll put it below.  it sets up a
grid of squares, with a button and an edit box at the bottom.  the first
square is highlighted in blue (the rest in red.)  you can move this blue
box around with the arrow keys - and pressing the button or typing in the
edit box doesn't interfere with the buttons.  you can also click on any
square, and it will be highlighted in green.

  is this anything like what you want?  -

Shoes.app do
x = 10; y = 10
stroke red
rs = []
3.times do
5.times do
r = rect(x, y, 100, 100)
x += 110
rs << r
r.click{
rs.each{|oldr| oldr.stroke = red}
r.stroke = green
}
end
x = 10; y += 110
end
 @fx = 10; @fy = 10
frame = rect(@fx, @fy, 100, 100)
frame.methods.sort.each{|m| p m}
frame.stroke = blue
 keypress{|key|
 case key
 when :up
if @fy < 11; @fy = 230
else; @fy -= 110
end
 when :down
if @fy > 229; @fy = 10
else; @fy += 110
end
 when :left
if @fx < 11; @fx = 450
else; @fx -= 110
end
 when :right
if @fx > 349; @fx = 10
else; @fx += 110
end
end
frame.move(@fx, @fy)
}
 @msg_text = "type in the edit box, buddy..."
msg = para().move(25, 400)
 btn = button("hi there") do
msg.text = @msg_text
msg.fill = rgb(rand(250), rand(250), rand(250))
end
btn.move(50, 450)

box = edit_box.move(250, 370)
box.change{|eb| @msg_text = eb.text}
end


  hope that's something like what you're after - Shoes on!

  - j


On Mon, Jan 21, 2013 at 10:36 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Essentially I'm building a program that has a a bunch of widgets -
> buttons, list_boxes etc - and I'm trying to use key commands to move around
> a grid of drawn rectangles.
>
> I.e I have a square that is drawn on top of the grid in another colour and
> is moved by the rect.move command. The problem arises when I click a
> button, or a list_box and the object steals the focus from the window, and
> I'm left with the inability to move the square via the wasd keys!
>
> Is there a way to remove focus, or reset it to the window?
>
> Alternatively, is there a way to add click objects to rectangles, so that
> I can just change the stroke colours?
>
> Cheers,
> Stuart
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-22 @ 00:02
Hey J.

While both of those options would be great, I can't get either to work in
my code! I believe it could be something to do with my layout, the main
difference is I'm calling methods from inside an list box,
and therefore nothing is drawn until an object is selected, which was when
the trouble started...

https://gist.github.com/47646b2148347db4e83c

Otherwise it worked fine up until I noticed the focus problem!

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-22 @ 02:54
Also, in your code, the keypresses don't work, they seem to be
automatically assigned to the textbox!


On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Hey J.
>
> While both of those options would be great, I can't get either to work in
> my code! I believe it could be something to do with my layout, the main
> difference is I'm calling methods from inside an list box,
> and therefore nothing is drawn until an object is selected, which was when
> the trouble started...
>
> https://gist.github.com/47646b2148347db4e83c
>
> Otherwise it worked fine up until I noticed the focus problem!
>

Re: [shoes] Removal of focus from objects

From:
J. Kaiden
Date:
2013-01-22 @ 10:57
hey Stuart,

i'll have to take a look at your gist when i've got more time (have to run
off to work at the moment...)

what OS and version of shoes are you using?  the keypresses definitely work
on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving the
blue box, they also move the cursor within the edit_box...

 - j


On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Also, in your code, the keypresses don't work, they seem to be
> automatically assigned to the textbox!
>
>
> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Hey J.
>>
>> While both of those options would be great, I can't get either to work in
>> my code! I believe it could be something to do with my layout, the main
>> difference is I'm calling methods from inside an list box,
>> and therefore nothing is drawn until an object is selected, which was when
>> the trouble started...
>>
>> https://gist.github.com/47646b2148347db4e83c
>>
>> Otherwise it worked fine up until I noticed the focus problem!
>>
>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-22 @ 17:59
Ok, thank's very much, there's a typo in the click method (I used one of
your var names instead of my own) but fixing that didnt change anything!

I'm red shoes 3, windows 7. In the mean time I shall port to green shoes
and see if anything changes!


On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com> wrote:

> hey Stuart,
>
> i'll have to take a look at your gist when i've got more time (have to run
> off to work at the moment...)
>
> what OS and version of shoes are you using?  the keypresses definitely
> work on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving
> the blue box, they also move the cursor within the edit_box...
>
>  - j
>
>
> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Also, in your code, the keypresses don't work, they seem to be
>> automatically assigned to the textbox!
>>
>>
>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Hey J.
>>>
>>> While both of those options would be great, I can't get either to work
>>> in my code! I believe it could be something to do with my layout, the main
>>> difference is I'm calling methods from inside an list box,
>>> and therefore nothing is drawn until an object is selected, which was when
>>> the trouble started...
>>>
>>> https://gist.github.com/47646b2148347db4e83c
>>>
>>> Otherwise it worked fine up until I noticed the focus problem!
>>>
>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-22 @ 20:15
Also trying it on a different PC didn't work, another windows 7 one sure,
but at least I know the issue isn't isolated!


On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Ok, thank's very much, there's a typo in the click method (I used one of
> your var names instead of my own) but fixing that didnt change anything!
>
> I'm red shoes 3, windows 7. In the mean time I shall port to green shoes
> and see if anything changes!
>
>
> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com> wrote:
>
>> hey Stuart,
>>
>> i'll have to take a look at your gist when i've got more time (have to
>> run off to work at the moment...)
>>
>> what OS and version of shoes are you using?  the keypresses definitely
>> work on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving
>> the blue box, they also move the cursor within the edit_box...
>>
>>  - j
>>
>>
>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Also, in your code, the keypresses don't work, they seem to be
>>> automatically assigned to the textbox!
>>>
>>>
>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>>
>>>> Hey J.
>>>>
>>>> While both of those options would be great, I can't get either to work
>>>> in my code! I believe it could be something to do with my layout, the main
>>>> difference is I'm calling methods from inside an list box,
>>>> and therefore nothing is drawn until an object is selected, which was when
>>>> the trouble started...
>>>>
>>>> https://gist.github.com/47646b2148347db4e83c
>>>>
>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>
>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-22 @ 20:46
Green shoes is throwing up errors at random times during any interacting
with even the basic layout, so I feel like I may have done something wildly
wrong! Full Gist in case it's outside the places I thought it would be!

https://gist.github.com/92be39ea21c73c93543e


On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Also trying it on a different PC didn't work, another windows 7 one sure,
> but at least I know the issue isn't isolated!
>
>
> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Ok, thank's very much, there's a typo in the click method (I used one of
>> your var names instead of my own) but fixing that didnt change anything!
>>
>> I'm red shoes 3, windows 7. In the mean time I shall port to green shoes
>> and see if anything changes!
>>
>>
>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com> wrote:
>>
>>> hey Stuart,
>>>
>>> i'll have to take a look at your gist when i've got more time (have to
>>> run off to work at the moment...)
>>>
>>> what OS and version of shoes are you using?  the keypresses definitely
>>> work on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving
>>> the blue box, they also move the cursor within the edit_box...
>>>
>>>  - j
>>>
>>>
>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>>
>>>> Also, in your code, the keypresses don't work, they seem to be
>>>> automatically assigned to the textbox!
>>>>
>>>>
>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <stuy.bradley@gmail.com
>>>> > wrote:
>>>>
>>>>> Hey J.
>>>>>
>>>>> While both of those options would be great, I can't get either to work
>>>>> in my code! I believe it could be something to do with my layout, the main
>>>>> difference is I'm calling methods from inside an list box,
>>>>> and therefore nothing is drawn until an object is selected, which was when
>>>>> the trouble started...
>>>>>
>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>
>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>
>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
J. Kaiden
Date:
2013-01-22 @ 23:55
hi Stuart,

  green and red shoes are different enough that i'm not surprised you're
getting errors with basic layout stuff.  i've played around with both, and
they're both great - but they are different in some important ways.

  so that much is not surprising...  now for the stuff that is:

  thanks for posting the full gist - it seems to run just fine on my
machine - selecting things from the listboxes doesn't interfere with moving
the yellow square around with keypresses.  i may be missing something
important, or this may be a platform issue - do you know anyone with a
different OS that you could try the thing out on?

  i was playing around with the :focus method, that according to the manual
is available for buttons, edit_boxes, edit_lines, radio buttons, check
boxes, and list_boxes.  it should (again, according to the manual) move
focus to the widget that calls it - but i tried doing something simple like
this:

Shoes.app do
eb = edit_box
eb.focus
end

  ...and it doesn't work.

  not sure what's going on (or not going on) there...  anyone got any ideas
about this one?

- j


On Tue, Jan 22, 2013 at 9:46 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Green shoes is throwing up errors at random times during any interacting
> with even the basic layout, so I feel like I may have done something wildly
> wrong! Full Gist in case it's outside the places I thought it would be!
>
> https://gist.github.com/92be39ea21c73c93543e
>
>
> On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Also trying it on a different PC didn't work, another windows 7 one sure,
>> but at least I know the issue isn't isolated!
>>
>>
>> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Ok, thank's very much, there's a typo in the click method (I used one of
>>> your var names instead of my own) but fixing that didnt change anything!
>>>
>>> I'm red shoes 3, windows 7. In the mean time I shall port to green shoes
>>> and see if anything changes!
>>>
>>>
>>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>
>>>> hey Stuart,
>>>>
>>>> i'll have to take a look at your gist when i've got more time (have to
>>>> run off to work at the moment...)
>>>>
>>>> what OS and version of shoes are you using?  the keypresses definitely
>>>> work on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving
>>>> the blue box, they also move the cursor within the edit_box...
>>>>
>>>>  - j
>>>>
>>>>
>>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <stuy.bradley@gmail.com
>>>> > wrote:
>>>>
>>>>> Also, in your code, the keypresses don't work, they seem to be
>>>>> automatically assigned to the textbox!
>>>>>
>>>>>
>>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <
>>>>> stuy.bradley@gmail.com> wrote:
>>>>>
>>>>>> Hey J.
>>>>>>
>>>>>> While both of those options would be great, I can't get either to
>>>>>> work in my code! I believe it could be something to do with my layout, the
>>>>>> main difference is I'm calling methods from inside an list box,
>>>>>> and therefore nothing is drawn until an object is selected, which was when
>>>>>> the trouble started...
>>>>>>
>>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>>
>>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 00:03
Hey Jake,

Thanks for letting me know the code works, I'll try a linux box when I can
get one, which will be next week I believe. As for my next step - unless
someone finds a solution - will be to go green and see if that helps at
all!

Thanks,
Stuart


On Wed, Jan 23, 2013 at 12:55 PM, J. Kaiden <jakekaiden@gmail.com> wrote:

> hi Stuart,
>
>   green and red shoes are different enough that i'm not surprised you're
> getting errors with basic layout stuff.  i've played around with both, and
> they're both great - but they are different in some important ways.
>
>   so that much is not surprising...  now for the stuff that is:
>
>   thanks for posting the full gist - it seems to run just fine on my
> machine - selecting things from the listboxes doesn't interfere with moving
> the yellow square around with keypresses.  i may be missing something
> important, or this may be a platform issue - do you know anyone with a
> different OS that you could try the thing out on?
>
>   i was playing around with the :focus method, that according to the
> manual is available for buttons, edit_boxes, edit_lines, radio buttons,
> check boxes, and list_boxes.  it should (again, according to the manual)
> move focus to the widget that calls it - but i tried doing something simple
> like this:
>
> Shoes.app do
> eb = edit_box
> eb.focus
> end
>
>   ...and it doesn't work.
>
>   not sure what's going on (or not going on) there...  anyone got any
> ideas about this one?
>
> - j
>
>
> On Tue, Jan 22, 2013 at 9:46 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Green shoes is throwing up errors at random times during any interacting
>> with even the basic layout, so I feel like I may have done something wildly
>> wrong! Full Gist in case it's outside the places I thought it would be!
>>
>> https://gist.github.com/92be39ea21c73c93543e
>>
>>
>> On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Also trying it on a different PC didn't work, another windows 7 one
>>> sure, but at least I know the issue isn't isolated!
>>>
>>>
>>> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>>
>>>> Ok, thank's very much, there's a typo in the click method (I used one
>>>> of your var names instead of my own) but fixing that didnt change anything!
>>>>
>>>> I'm red shoes 3, windows 7. In the mean time I shall port to green
>>>> shoes and see if anything changes!
>>>>
>>>>
>>>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>>
>>>>> hey Stuart,
>>>>>
>>>>> i'll have to take a look at your gist when i've got more time (have to
>>>>> run off to work at the moment...)
>>>>>
>>>>> what OS and version of shoes are you using?  the keypresses definitely
>>>>> work on my setup here...  ubuntu 12.04, shoes 3 - though apart from moving
>>>>> the blue box, they also move the cursor within the edit_box...
>>>>>
>>>>>  - j
>>>>>
>>>>>
>>>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <
>>>>> stuy.bradley@gmail.com> wrote:
>>>>>
>>>>>> Also, in your code, the keypresses don't work, they seem to be
>>>>>> automatically assigned to the textbox!
>>>>>>
>>>>>>
>>>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <
>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>
>>>>>>> Hey J.
>>>>>>>
>>>>>>> While both of those options would be great, I can't get either to
>>>>>>> work in my code! I believe it could be something to do with my layout, the
>>>>>>> main difference is I'm calling methods from inside an list box,
>>>>>>> and therefore nothing is drawn until an object is selected, which was when
>>>>>>> the trouble started...
>>>>>>>
>>>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>>>
>>>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
J. Kaiden
Date:
2013-01-23 @ 00:19
good luck with the project...

green shoes is neat - you can call GTK widgets directly, and you can
package up your app together with green shoes in a gem.

play around with it and i think you'll figure out the differences.  maybe
these will help some:

https://github.com/lljk/shoes-stuff/blob/master/breakout_red.rb

https://github.com/lljk/shoes-stuff/blob/master/breakout_green.rb

  ...same game in red and green.

rock those Shoes

- j


On Wed, Jan 23, 2013 at 1:03 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Hey Jake,
>
> Thanks for letting me know the code works, I'll try a linux box when I can
> get one, which will be next week I believe. As for my next step - unless
> someone finds a solution - will be to go green and see if that helps at
> all!
>
> Thanks,
> Stuart
>
>
> On Wed, Jan 23, 2013 at 12:55 PM, J. Kaiden <jakekaiden@gmail.com> wrote:
>
>> hi Stuart,
>>
>>   green and red shoes are different enough that i'm not surprised you're
>> getting errors with basic layout stuff.  i've played around with both, and
>> they're both great - but they are different in some important ways.
>>
>>   so that much is not surprising...  now for the stuff that is:
>>
>>   thanks for posting the full gist - it seems to run just fine on my
>> machine - selecting things from the listboxes doesn't interfere with moving
>> the yellow square around with keypresses.  i may be missing something
>> important, or this may be a platform issue - do you know anyone with a
>> different OS that you could try the thing out on?
>>
>>   i was playing around with the :focus method, that according to the
>> manual is available for buttons, edit_boxes, edit_lines, radio buttons,
>> check boxes, and list_boxes.  it should (again, according to the manual)
>> move focus to the widget that calls it - but i tried doing something simple
>> like this:
>>
>> Shoes.app do
>> eb = edit_box
>> eb.focus
>> end
>>
>>   ...and it doesn't work.
>>
>>   not sure what's going on (or not going on) there...  anyone got any
>> ideas about this one?
>>
>> - j
>>
>>
>> On Tue, Jan 22, 2013 at 9:46 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Green shoes is throwing up errors at random times during any interacting
>>> with even the basic layout, so I feel like I may have done something wildly
>>> wrong! Full Gist in case it's outside the places I thought it would be!
>>>
>>> https://gist.github.com/92be39ea21c73c93543e
>>>
>>>
>>> On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>>
>>>> Also trying it on a different PC didn't work, another windows 7 one
>>>> sure, but at least I know the issue isn't isolated!
>>>>
>>>>
>>>> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <stuy.bradley@gmail.com
>>>> > wrote:
>>>>
>>>>> Ok, thank's very much, there's a typo in the click method (I used one
>>>>> of your var names instead of my own) but fixing that didnt change anything!
>>>>>
>>>>> I'm red shoes 3, windows 7. In the mean time I shall port to green
>>>>> shoes and see if anything changes!
>>>>>
>>>>>
>>>>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>>>
>>>>>> hey Stuart,
>>>>>>
>>>>>> i'll have to take a look at your gist when i've got more time (have
>>>>>> to run off to work at the moment...)
>>>>>>
>>>>>> what OS and version of shoes are you using?  the keypresses
>>>>>> definitely work on my setup here...  ubuntu 12.04, shoes 3 - though apart
>>>>>> from moving the blue box, they also move the cursor within the edit_box...
>>>>>>
>>>>>>  - j
>>>>>>
>>>>>>
>>>>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <
>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>
>>>>>>> Also, in your code, the keypresses don't work, they seem to be
>>>>>>> automatically assigned to the textbox!
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <
>>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hey J.
>>>>>>>>
>>>>>>>> While both of those options would be great, I can't get either to
>>>>>>>> work in my code! I believe it could be something to do with my 
layout, the
>>>>>>>> main difference is I'm calling methods from inside an list box,
>>>>>>>> and therefore nothing is drawn until an object is selected, which
was when
>>>>>>>> the trouble started...
>>>>>>>>
>>>>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>>>>
>>>>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 01:30
Projects porting fine, most of the code is transferable. But on two
machines I'm getting Segmentation Faults when I try and do anything with
the list boxes. If I remove all elements from my app apart from the boxes
they'll work fine, but as soon as I add a label or button, they Seg fault
again. Don't suppose you'd be able to green shoes my code and see if it
happens to you? Apart from the requires 'green_shoes' the code works as is,
apart from format errors (Which I can fix), I just can't find a solution to
the Seg errors!


On Wed, Jan 23, 2013 at 1:19 PM, J. Kaiden <jakekaiden@gmail.com> wrote:

> good luck with the project...
>
> green shoes is neat - you can call GTK widgets directly, and you can
> package up your app together with green shoes in a gem.
>
> play around with it and i think you'll figure out the differences.  maybe
> these will help some:
>
> https://github.com/lljk/shoes-stuff/blob/master/breakout_red.rb
>
> https://github.com/lljk/shoes-stuff/blob/master/breakout_green.rb
>
>   ...same game in red and green.
>
> rock those Shoes
>
> - j
>
>
> On Wed, Jan 23, 2013 at 1:03 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> Hey Jake,
>>
>> Thanks for letting me know the code works, I'll try a linux box when I
>> can get one, which will be next week I believe. As for my next step -
>> unless someone finds a solution - will be to go green and see if that helps
>> at all!
>>
>> Thanks,
>> Stuart
>>
>>
>> On Wed, Jan 23, 2013 at 12:55 PM, J. Kaiden <jakekaiden@gmail.com> wrote:
>>
>>> hi Stuart,
>>>
>>>   green and red shoes are different enough that i'm not surprised you're
>>> getting errors with basic layout stuff.  i've played around with both, and
>>> they're both great - but they are different in some important ways.
>>>
>>>   so that much is not surprising...  now for the stuff that is:
>>>
>>>   thanks for posting the full gist - it seems to run just fine on my
>>> machine - selecting things from the listboxes doesn't interfere with moving
>>> the yellow square around with keypresses.  i may be missing something
>>> important, or this may be a platform issue - do you know anyone with a
>>> different OS that you could try the thing out on?
>>>
>>>   i was playing around with the :focus method, that according to the
>>> manual is available for buttons, edit_boxes, edit_lines, radio buttons,
>>> check boxes, and list_boxes.  it should (again, according to the manual)
>>> move focus to the widget that calls it - but i tried doing something simple
>>> like this:
>>>
>>> Shoes.app do
>>> eb = edit_box
>>> eb.focus
>>> end
>>>
>>>   ...and it doesn't work.
>>>
>>>   not sure what's going on (or not going on) there...  anyone got any
>>> ideas about this one?
>>>
>>> - j
>>>
>>>
>>> On Tue, Jan 22, 2013 at 9:46 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>>
>>>> Green shoes is throwing up errors at random times during any
>>>> interacting with even the basic layout, so I feel like I may have done
>>>> something wildly wrong! Full Gist in case it's outside the places I thought
>>>> it would be!
>>>>
>>>> https://gist.github.com/92be39ea21c73c93543e
>>>>
>>>>
>>>> On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <stuy.bradley@gmail.com
>>>> > wrote:
>>>>
>>>>> Also trying it on a different PC didn't work, another windows 7 one
>>>>> sure, but at least I know the issue isn't isolated!
>>>>>
>>>>>
>>>>> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <
>>>>> stuy.bradley@gmail.com> wrote:
>>>>>
>>>>>> Ok, thank's very much, there's a typo in the click method (I used one
>>>>>> of your var names instead of my own) but fixing that didnt change anything!
>>>>>>
>>>>>> I'm red shoes 3, windows 7. In the mean time I shall port to green
>>>>>> shoes and see if anything changes!
>>>>>>
>>>>>>
>>>>>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>>>>
>>>>>>> hey Stuart,
>>>>>>>
>>>>>>> i'll have to take a look at your gist when i've got more time (have
>>>>>>> to run off to work at the moment...)
>>>>>>>
>>>>>>> what OS and version of shoes are you using?  the keypresses
>>>>>>> definitely work on my setup here...  ubuntu 12.04, shoes 3 - though apart
>>>>>>> from moving the blue box, they also move the cursor within the edit_box...
>>>>>>>
>>>>>>>  - j
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <
>>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>>
>>>>>>>> Also, in your code, the keypresses don't work, they seem to be
>>>>>>>> automatically assigned to the textbox!
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <
>>>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hey J.
>>>>>>>>>
>>>>>>>>> While both of those options would be great, I can't get either to
>>>>>>>>> work in my code! I believe it could be something to do with my 
layout, the
>>>>>>>>> main difference is I'm calling methods from inside an list box,
>>>>>>>>> and therefore nothing is drawn until an object is selected, 
which was when
>>>>>>>>> the trouble started...
>>>>>>>>>
>>>>>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>>>>>
>>>>>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 01:48
To illustrate my point: https://gist.github.com/0bca5a676537008a910c (Top
one works, bottom one causes segmentation Fault). I realise this may be a
seperate question, but it could also be that something is very wrong with
my coding environment!


On Wed, Jan 23, 2013 at 2:30 PM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Projects porting fine, most of the code is transferable. But on two
> machines I'm getting Segmentation Faults when I try and do anything with
> the list boxes. If I remove all elements from my app apart from the boxes
> they'll work fine, but as soon as I add a label or button, they Seg fault
> again. Don't suppose you'd be able to green shoes my code and see if it
> happens to you? Apart from the requires 'green_shoes' the code works as is,
> apart from format errors (Which I can fix), I just can't find a solution to
> the Seg errors!
>
>
> On Wed, Jan 23, 2013 at 1:19 PM, J. Kaiden <jakekaiden@gmail.com> wrote:
>
>> good luck with the project...
>>
>> green shoes is neat - you can call GTK widgets directly, and you can
>> package up your app together with green shoes in a gem.
>>
>> play around with it and i think you'll figure out the differences.  maybe
>> these will help some:
>>
>> https://github.com/lljk/shoes-stuff/blob/master/breakout_red.rb
>>
>> https://github.com/lljk/shoes-stuff/blob/master/breakout_green.rb
>>
>>   ...same game in red and green.
>>
>> rock those Shoes
>>
>> - j
>>
>>
>> On Wed, Jan 23, 2013 at 1:03 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> Hey Jake,
>>>
>>> Thanks for letting me know the code works, I'll try a linux box when I
>>> can get one, which will be next week I believe. As for my next step -
>>> unless someone finds a solution - will be to go green and see if that helps
>>> at all!
>>>
>>> Thanks,
>>> Stuart
>>>
>>>
>>> On Wed, Jan 23, 2013 at 12:55 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>
>>>> hi Stuart,
>>>>
>>>>   green and red shoes are different enough that i'm not surprised
>>>> you're getting errors with basic layout stuff.  i've played around with
>>>> both, and they're both great - but they are different in some important
>>>> ways.
>>>>
>>>>   so that much is not surprising...  now for the stuff that is:
>>>>
>>>>   thanks for posting the full gist - it seems to run just fine on my
>>>> machine - selecting things from the listboxes doesn't interfere with moving
>>>> the yellow square around with keypresses.  i may be missing something
>>>> important, or this may be a platform issue - do you know anyone with a
>>>> different OS that you could try the thing out on?
>>>>
>>>>   i was playing around with the :focus method, that according to the
>>>> manual is available for buttons, edit_boxes, edit_lines, radio buttons,
>>>> check boxes, and list_boxes.  it should (again, according to the manual)
>>>> move focus to the widget that calls it - but i tried doing something simple
>>>> like this:
>>>>
>>>> Shoes.app do
>>>> eb = edit_box
>>>> eb.focus
>>>> end
>>>>
>>>>   ...and it doesn't work.
>>>>
>>>>   not sure what's going on (or not going on) there...  anyone got any
>>>> ideas about this one?
>>>>
>>>> - j
>>>>
>>>>
>>>> On Tue, Jan 22, 2013 at 9:46 PM, Stuart Bradley <stuy.bradley@gmail.com
>>>> > wrote:
>>>>
>>>>> Green shoes is throwing up errors at random times during any
>>>>> interacting with even the basic layout, so I feel like I may have done
>>>>> something wildly wrong! Full Gist in case it's outside the places I thought
>>>>> it would be!
>>>>>
>>>>> https://gist.github.com/92be39ea21c73c93543e
>>>>>
>>>>>
>>>>> On Wed, Jan 23, 2013 at 9:15 AM, Stuart Bradley <
>>>>> stuy.bradley@gmail.com> wrote:
>>>>>
>>>>>> Also trying it on a different PC didn't work, another windows 7 one
>>>>>> sure, but at least I know the issue isn't isolated!
>>>>>>
>>>>>>
>>>>>> On Wed, Jan 23, 2013 at 6:59 AM, Stuart Bradley <
>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>
>>>>>>> Ok, thank's very much, there's a typo in the click method (I used
>>>>>>> one of your var names instead of my own) but fixing that didnt change
>>>>>>> anything!
>>>>>>>
>>>>>>> I'm red shoes 3, windows 7. In the mean time I shall port to green
>>>>>>> shoes and see if anything changes!
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jan 22, 2013 at 11:57 PM, J. Kaiden <jakekaiden@gmail.com>wrote:
>>>>>>>
>>>>>>>> hey Stuart,
>>>>>>>>
>>>>>>>> i'll have to take a look at your gist when i've got more time (have
>>>>>>>> to run off to work at the moment...)
>>>>>>>>
>>>>>>>> what OS and version of shoes are you using?  the keypresses
>>>>>>>> definitely work on my setup here...  ubuntu 12.04, shoes 3 - though apart
>>>>>>>> from moving the blue box, they also move the cursor within the 
edit_box...
>>>>>>>>
>>>>>>>>  - j
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Jan 22, 2013 at 3:54 AM, Stuart Bradley <
>>>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Also, in your code, the keypresses don't work, they seem to be
>>>>>>>>> automatically assigned to the textbox!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Jan 22, 2013 at 1:02 PM, Stuart Bradley <
>>>>>>>>> stuy.bradley@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hey J.
>>>>>>>>>>
>>>>>>>>>> While both of those options would be great, I can't get either to
>>>>>>>>>> work in my code! I believe it could be something to do with my 
layout, the
>>>>>>>>>> main difference is I'm calling methods from inside an list box,
>>>>>>>>>> and therefore nothing is drawn until an object is selected, 
which was when
>>>>>>>>>> the trouble started...
>>>>>>>>>>
>>>>>>>>>> https://gist.github.com/47646b2148347db4e83c
>>>>>>>>>>
>>>>>>>>>> Otherwise it worked fine up until I noticed the focus problem!
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Sebastjan Hribar
Date:
2013-01-23 @ 08:46
Hi Stuart,

> To illustrate my point: https://gist.github.com/0bca5a676537008a910c
> (Top one works, bottom one causes segmentation Fault). I realise this
> may be a seperate question, but it could also be that something is
> very wrong with my coding environment! 
> 
I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
shoes).
I thought it might have something to do with the differences between
both shoes versions but I guess the reason must be somewhere else. Both
work fine in green.


In general, have a look at these:
http://ashbb.github.com/green_shoes/vs.RedShoes.html
http://ashbb.github.com/green_shoes/Red_Shoes_and_Green_Shoes.html

however, there are a few more differences pointed out in the green shoes
manual: http://ashbb.github.com/green_shoes/

I usually use green shoes but I am no expert in either one yet:)

love shoes!
regards
seba

>                                                                         
>                                                                 
>                                                                 
>                                                         
>                                                         
>                                                 
>                                                 
>                                         
>                                         
>                                 
>                                 
>                         
>                         
>                 
>                 
>         
>         
> 
> 

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 08:54
Well thanks for testing them, it very my seems to be a windows error of
sorts, perhaps it's time to port to Java or some such! I small keep
battling the bugs for awhile longer though!


On Wed, Jan 23, 2013 at 9:46 PM, Sebastjan Hribar <
sebastjan.hribar@gmail.com> wrote:

> Hi Stuart,
>
> > To illustrate my point: https://gist.github.com/0bca5a676537008a910c
> > (Top one works, bottom one causes segmentation Fault). I realise this
> > may be a seperate question, but it could also be that something is
> > very wrong with my coding environment!
> >
> I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
> shoes).
> I thought it might have something to do with the differences between
> both shoes versions but I guess the reason must be somewhere else. Both
> work fine in green.
>
>
> In general, have a look at these:
> http://ashbb.github.com/green_shoes/vs.RedShoes.html
> http://ashbb.github.com/green_shoes/Red_Shoes_and_Green_Shoes.html
>
> however, there are a few more differences pointed out in the green shoes
> manual: http://ashbb.github.com/green_shoes/
>
> I usually use green shoes but I am no expert in either one yet:)
>
> love shoes!
> regards
> seba
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>

Re: [shoes] Removal of focus from objects

From:
ashbb
Date:
2013-01-23 @ 10:41
Hi Stuart, J, Seba and folks,

Sorry for my late reply.
As J is already guessing, this may be a Windows issue.
You can shift the focus among the Native objects (i.e. EditBox, EditLine,
ListBox, Button, etc.), but can't remove it. Once Shoes gives the focus on
a Native object (e.g. an edit_box object), `keypress` can't get anything...
:(

So, if you agree to use Green Shoes and to write your app without EditBox,
the following snippet may help you... hopefully.

require 'green_shoes'
Shoes.app do
  list_box items: %w[red green blue yellow] do |lb|
    alert "#{lb.text} is selected!"
  end
  flow width: 300, height: 200 do
    background yellow
    @msg = para
    @msg.cursor = -1
  end
  nostroke
  r = rect 100, 300, 100, 100, fill: red
  r.click{r.style fill: blue}
  keypress do |k|
    case k
      when 'Right'
        r.move r.left + 100, r.top
      when 'Left'
        r.move r.left - 100, r.top
      when 'Up'
        r.move r.left, r.top - 100
      when 'Down'
        r.move r.left, r.top + 100
      when 'BackSpace'
        @msg.text = @msg.text[0...-1]
        flush
      else
        @msg.text += k
        flush
    end
  end
end

ashbb

Re: [shoes] Removal of focus from objects

From:
ashbb
Date:
2013-01-23 @ 10:43
@Seba

> I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
> shoes).
Wow, glad to hear that. Thanks for the confirmation. :)

@Stuart

I've also tried both and they worked on my Windows 7.
But I'm using
- ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
- green_shoes (1.1.367)
- gtk2 (1.1.5 x86-mingw32)

So, gtk2 is not the latest version. What version are you using?

ashbb

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 20:25
@ashbb

- ruby 1.9.3p362 (2012-12-25) [i386-mingw32]
- green_shoes (1.1.367)
- gtk2-1.1.9 x86-mingw32

I'll roll back my gtk2 and see what happens... Nothing.

Same error, which I've uploaded, along with the exact code to: [
https://gist.github.com/b95869410c83d6d6a148]

I can possibly lose the list boxes if I make the drawing horizontally
scrollable. I understand I can do that with GTK2 correct?

@Jake

Thanks for checking for me! Always good to narrow down where the bugs are
hiding!



On Wed, Jan 23, 2013 at 11:43 PM, ashbb <ashbbb@gmail.com> wrote:

> @Seba
>
>
> > I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
> > shoes).
> Wow, glad to hear that. Thanks for the confirmation. :)
>
> @Stuart
>
> I've also tried both and they worked on my Windows 7.
> But I'm using
> - ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
> - green_shoes (1.1.367)
> - gtk2 (1.1.5 x86-mingw32)
>
> So, gtk2 is not the latest version. What version are you using?
>
> ashbb
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 22:54
Follow up question, like textboxes, do shapes have to have their
width specified in green shoes? I having trouble placing my rectangle array
the same way my original red shoes does it!

FYI: Green shoes keypresses work on wasd without list_boxes, so thanks for
the help everyone :D


On Thu, Jan 24, 2013 at 9:25 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> @ashbb
>
> - ruby 1.9.3p362 (2012-12-25) [i386-mingw32]
> - green_shoes (1.1.367)
> - gtk2-1.1.9 x86-mingw32
>
> I'll roll back my gtk2 and see what happens... Nothing.
>
> Same error, which I've uploaded, along with the exact code to: [
> https://gist.github.com/b95869410c83d6d6a148]
>
> I can possibly lose the list boxes if I make the drawing horizontally
> scrollable. I understand I can do that with GTK2 correct?
>
> @Jake
>
> Thanks for checking for me! Always good to narrow down where the bugs are
> hiding!
>
>
>
> On Wed, Jan 23, 2013 at 11:43 PM, ashbb <ashbbb@gmail.com> wrote:
>
>> @Seba
>>
>>
>> > I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
>> > shoes).
>> Wow, glad to hear that. Thanks for the confirmation. :)
>>
>> @Stuart
>>
>> I've also tried both and they worked on my Windows 7.
>> But I'm using
>> - ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
>> - green_shoes (1.1.367)
>> - gtk2 (1.1.5 x86-mingw32)
>>
>> So, gtk2 is not the latest version. What version are you using?
>>
>> ashbb
>>
>
>

Re: [shoes] Removal of focus from objects

From:
ashbb
Date:
2013-01-24 @ 11:39
@J

> but under red shoes it doesn't seem to work for me...
> i also tried tying the edit_box focus to a button click,
> and that doesn't work under red either:
Oh my! Both snippets you posted work well with Red Shoes on my Windows.
We seem to find another difference in platforms... :-P

@Stuart

Sorry, I had kind of confused...
Could you let me know if the following snippet works or not?

require 'green_shoes'
Shoes.app do
  list_box items: %w[red green blue yellow] do |lb|
    alert "#{lb.text} is selected!"
  end
  edit_box
  nostroke
  r = rect 100, 300, 100, 100, fill: red
  r.click{r.style fill: blue}
  keypress do |k|
    case k
      when 'Right'
        r.move r.left + 100, r.top
      when 'Left'
        r.move r.left - 100, r.top
      when 'Up'
        r.move r.left, r.top - 100
      when 'Down'
        r.move r.left, r.top + 100
      else
    end
  end
end

I wrote
- "Once Shoes gives the focus on a Native object (e.g. an edit_box
  object), `keypress` can't get anything... :("

But in Green Shoes, keypress seems to get everything at any time.

About your `Follow up question`.
There may be a few differences to specify shape's width.
Could you show me the code you want to write?

ashbb

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-24 @ 20:17
@ash

That snippet works fine, so it must be my code. I may rewrite it from
scratch and see if that solves anything.

So essentially what I'm trying to do is this:
http://i.imgur.com/Irb4FEQ.png(Red Shoes program) - Where that
coloured grid can expand in all directions
indefinitely. Horizontal would be nice, but it's currently replaced by the
exceptions list_box at the top, showing different horizontal portions.

In green shoes it appears as: http://i.imgur.com/lcBb4tu.png and I can't
seem to get the grid into the correct place! Nor do list_boxes work without
Seg faults, and I'm at a loss to integrate scrolling from GTK!

The current code for both is: https://gist.github.com/04beb9c20d3a75db70bc


On Fri, Jan 25, 2013 at 12:39 AM, ashbb <ashbbb@gmail.com> wrote:

> @J
>
>
> > but under red shoes it doesn't seem to work for me...
> > i also tried tying the edit_box focus to a button click,
> > and that doesn't work under red either:
> Oh my! Both snippets you posted work well with Red Shoes on my Windows.
> We seem to find another difference in platforms... :-P
>
> @Stuart
>
> Sorry, I had kind of confused...
> Could you let me know if the following snippet works or not?
>
>
> require 'green_shoes'
> Shoes.app do
>   list_box items: %w[red green blue yellow] do |lb|
>     alert "#{lb.text} is selected!"
>   end
>   edit_box
>
>   nostroke
>   r = rect 100, 300, 100, 100, fill: red
>   r.click{r.style fill: blue}
>   keypress do |k|
>     case k
>       when 'Right'
>         r.move r.left + 100, r.top
>       when 'Left'
>         r.move r.left - 100, r.top
>       when 'Up'
>         r.move r.left, r.top - 100
>       when 'Down'
>         r.move r.left, r.top + 100
>       else
>     end
>   end
> end
>
> I wrote
>
> - "Once Shoes gives the focus on a Native object (e.g. an edit_box
>   object), `keypress` can't get anything... :("
>
> But in Green Shoes, keypress seems to get everything at any time.
>
> About your `Follow up question`.
> There may be a few differences to specify shape's width.
> Could you show me the code you want to write?
>
> ashbb
>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-24 @ 20:23
An 'ideal' Java swing mock-up is http://i.imgur.com/W44JXXU.png - but Swing
is so unwieldy to code, and I'd be the only one in the project able to fix
bugs, hence my reluctance to jump the shoes ship!


On Fri, Jan 25, 2013 at 9:17 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> @ash
>
> That snippet works fine, so it must be my code. I may rewrite it from
> scratch and see if that solves anything.
>
> So essentially what I'm trying to do is this:
> http://i.imgur.com/Irb4FEQ.png (Red Shoes program) - Where that coloured
> grid can expand in all directions indefinitely. Horizontal would be nice,
> but it's currently replaced by the exceptions list_box at the top, showing
> different horizontal portions.
>
> In green shoes it appears as: http://i.imgur.com/lcBb4tu.png and I can't
> seem to get the grid into the correct place! Nor do list_boxes work without
> Seg faults, and I'm at a loss to integrate scrolling from GTK!
>
> The current code for both is: https://gist.github.com/04beb9c20d3a75db70bc
>
>
>
> On Fri, Jan 25, 2013 at 12:39 AM, ashbb <ashbbb@gmail.com> wrote:
>
>> @J
>>
>>
>> > but under red shoes it doesn't seem to work for me...
>> > i also tried tying the edit_box focus to a button click,
>> > and that doesn't work under red either:
>> Oh my! Both snippets you posted work well with Red Shoes on my Windows.
>> We seem to find another difference in platforms... :-P
>>
>> @Stuart
>>
>> Sorry, I had kind of confused...
>> Could you let me know if the following snippet works or not?
>>
>>
>> require 'green_shoes'
>> Shoes.app do
>>   list_box items: %w[red green blue yellow] do |lb|
>>     alert "#{lb.text} is selected!"
>>   end
>>   edit_box
>>
>>   nostroke
>>   r = rect 100, 300, 100, 100, fill: red
>>   r.click{r.style fill: blue}
>>   keypress do |k|
>>     case k
>>       when 'Right'
>>         r.move r.left + 100, r.top
>>       when 'Left'
>>         r.move r.left - 100, r.top
>>       when 'Up'
>>         r.move r.left, r.top - 100
>>       when 'Down'
>>         r.move r.left, r.top + 100
>>       else
>>     end
>>   end
>> end
>>
>> I wrote
>>
>> - "Once Shoes gives the focus on a Native object (e.g. an edit_box
>>   object), `keypress` can't get anything... :("
>>
>> But in Green Shoes, keypress seems to get everything at any time.
>>
>> About your `Follow up question`.
>> There may be a few differences to specify shape's width.
>> Could you show me the code you want to write?
>>
>> ashbb
>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-24 @ 20:35
Ok key presses are working now, using 'Up' 'Down' etc, but even just
directly copying your listbox code into my program and then trying to use
it causes a fault!


On Fri, Jan 25, 2013 at 9:23 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> An 'ideal' Java swing mock-up is http://i.imgur.com/W44JXXU.png - but
> Swing is so unwieldy to code, and I'd be the only one in the project able
> to fix bugs, hence my reluctance to jump the shoes ship!
>
>
> On Fri, Jan 25, 2013 at 9:17 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> @ash
>>
>> That snippet works fine, so it must be my code. I may rewrite it from
>> scratch and see if that solves anything.
>>
>> So essentially what I'm trying to do is this:
>> http://i.imgur.com/Irb4FEQ.png (Red Shoes program) - Where that coloured
>> grid can expand in all directions indefinitely. Horizontal would be nice,
>> but it's currently replaced by the exceptions list_box at the top, showing
>> different horizontal portions.
>>
>> In green shoes it appears as: http://i.imgur.com/lcBb4tu.png and I can't
>> seem to get the grid into the correct place! Nor do list_boxes work without
>> Seg faults, and I'm at a loss to integrate scrolling from GTK!
>>
>> The current code for both is:
>> https://gist.github.com/04beb9c20d3a75db70bc
>>
>>
>> On Fri, Jan 25, 2013 at 12:39 AM, ashbb <ashbbb@gmail.com> wrote:
>>
>>> @J
>>>
>>>
>>> > but under red shoes it doesn't seem to work for me...
>>> > i also tried tying the edit_box focus to a button click,
>>> > and that doesn't work under red either:
>>> Oh my! Both snippets you posted work well with Red Shoes on my Windows.
>>> We seem to find another difference in platforms... :-P
>>>
>>> @Stuart
>>>
>>> Sorry, I had kind of confused...
>>> Could you let me know if the following snippet works or not?
>>>
>>>
>>> require 'green_shoes'
>>> Shoes.app do
>>>   list_box items: %w[red green blue yellow] do |lb|
>>>     alert "#{lb.text} is selected!"
>>>   end
>>>   edit_box
>>>
>>>   nostroke
>>>   r = rect 100, 300, 100, 100, fill: red
>>>   r.click{r.style fill: blue}
>>>   keypress do |k|
>>>     case k
>>>       when 'Right'
>>>         r.move r.left + 100, r.top
>>>       when 'Left'
>>>         r.move r.left - 100, r.top
>>>       when 'Up'
>>>         r.move r.left, r.top - 100
>>>       when 'Down'
>>>         r.move r.left, r.top + 100
>>>       else
>>>     end
>>>   end
>>> end
>>>
>>> I wrote
>>>
>>> - "Once Shoes gives the focus on a Native object (e.g. an edit_box
>>>   object), `keypress` can't get anything... :("
>>>
>>> But in Green Shoes, keypress seems to get everything at any time.
>>>
>>> About your `Follow up question`.
>>> There may be a few differences to specify shape's width.
>>> Could you show me the code you want to write?
>>>
>>> ashbb
>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-24 @ 20:44
...

Found the list_box Segmentation fault error, had the Red Shoes version of
the image code. Removed it, and it works for the phenotype list box, but
whenever I use the exception one a SECOND time, ie after the map has been
populated once, it crashes. Could be to do with it not being in the correct
place yet, not sure.


On Fri, Jan 25, 2013 at 9:35 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> Ok key presses are working now, using 'Up' 'Down' etc, but even just
> directly copying your listbox code into my program and then trying to use
> it causes a fault!
>
>
> On Fri, Jan 25, 2013 at 9:23 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>
>> An 'ideal' Java swing mock-up is http://i.imgur.com/W44JXXU.png - but
>> Swing is so unwieldy to code, and I'd be the only one in the project able
>> to fix bugs, hence my reluctance to jump the shoes ship!
>>
>>
>> On Fri, Jan 25, 2013 at 9:17 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:
>>
>>> @ash
>>>
>>> That snippet works fine, so it must be my code. I may rewrite it from
>>> scratch and see if that solves anything.
>>>
>>> So essentially what I'm trying to do is this:
>>> http://i.imgur.com/Irb4FEQ.png (Red Shoes program) - Where that
>>> coloured grid can expand in all directions indefinitely. Horizontal would
>>> be nice, but it's currently replaced by the exceptions list_box at the top,
>>> showing different horizontal portions.
>>>
>>> In green shoes it appears as: http://i.imgur.com/lcBb4tu.png and I
>>> can't seem to get the grid into the correct place! Nor do list_boxes work
>>> without Seg faults, and I'm at a loss to integrate scrolling from GTK!
>>>
>>> The current code for both is:
>>> https://gist.github.com/04beb9c20d3a75db70bc
>>>
>>>
>>> On Fri, Jan 25, 2013 at 12:39 AM, ashbb <ashbbb@gmail.com> wrote:
>>>
>>>> @J
>>>>
>>>>
>>>> > but under red shoes it doesn't seem to work for me...
>>>> > i also tried tying the edit_box focus to a button click,
>>>> > and that doesn't work under red either:
>>>> Oh my! Both snippets you posted work well with Red Shoes on my Windows.
>>>> We seem to find another difference in platforms... :-P
>>>>
>>>> @Stuart
>>>>
>>>> Sorry, I had kind of confused...
>>>> Could you let me know if the following snippet works or not?
>>>>
>>>>
>>>> require 'green_shoes'
>>>> Shoes.app do
>>>>   list_box items: %w[red green blue yellow] do |lb|
>>>>     alert "#{lb.text} is selected!"
>>>>   end
>>>>   edit_box
>>>>
>>>>   nostroke
>>>>   r = rect 100, 300, 100, 100, fill: red
>>>>   r.click{r.style fill: blue}
>>>>   keypress do |k|
>>>>     case k
>>>>       when 'Right'
>>>>         r.move r.left + 100, r.top
>>>>       when 'Left'
>>>>         r.move r.left - 100, r.top
>>>>       when 'Up'
>>>>         r.move r.left, r.top - 100
>>>>       when 'Down'
>>>>         r.move r.left, r.top + 100
>>>>       else
>>>>     end
>>>>   end
>>>> end
>>>>
>>>> I wrote
>>>>
>>>> - "Once Shoes gives the focus on a Native object (e.g. an edit_box
>>>>   object), `keypress` can't get anything... :("
>>>>
>>>> But in Green Shoes, keypress seems to get everything at any time.
>>>>
>>>> About your `Follow up question`.
>>>> There may be a few differences to specify shape's width.
>>>> Could you show me the code you want to write?
>>>>
>>>> ashbb
>>>>
>>>>
>>>
>>
>

Re: [shoes] Removal of focus from objects

From:
ashbb
Date:
2013-01-25 @ 12:02
Hi Stuart,

Thank you for the details.
I edited your lutrasdebtra/GreenShoesV2.rb a little bit for Green Shoes.
Try it out. ;-)

http://pastebin.com/WpSNQTgS

ashbb

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-28 @ 20:11
Hello,

Been AFK last few days - long weekend here in Auckland, New Zealand - code
works perfectly!

Thanks for your assistance, if I finish the project I'll be sure to post it
so you can put it in your samples!

Cheers,

Stuart


On Sat, Jan 26, 2013 at 1:02 AM, ashbb <ashbbb@gmail.com> wrote:

> Hi Stuart,
>
> Thank you for the details.
> I edited your lutrasdebtra/GreenShoesV2.rb a little bit for Green Shoes.
> Try it out. ;-)
>
> http://pastebin.com/WpSNQTgS
>
> ashbb
>

Re: [shoes] Removal of focus from objects

From:
Stuart Bradley
Date:
2013-01-23 @ 20:37
@ashbb even without the edit_boxes the buttons still take focus when key
commands are entered!


On Thu, Jan 24, 2013 at 9:25 AM, Stuart Bradley <stuy.bradley@gmail.com>wrote:

> @ashbb
>
> - ruby 1.9.3p362 (2012-12-25) [i386-mingw32]
> - green_shoes (1.1.367)
> - gtk2-1.1.9 x86-mingw32
>
> I'll roll back my gtk2 and see what happens... Nothing.
>
> Same error, which I've uploaded, along with the exact code to: [
> https://gist.github.com/b95869410c83d6d6a148]
>
> I can possibly lose the list boxes if I make the drawing horizontally
> scrollable. I understand I can do that with GTK2 correct?
>
> @Jake
>
> Thanks for checking for me! Always good to narrow down where the bugs are
> hiding!
>
>
>
> On Wed, Jan 23, 2013 at 11:43 PM, ashbb <ashbbb@gmail.com> wrote:
>
>> @Seba
>>
>>
>> > I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
>> > shoes).
>> Wow, glad to hear that. Thanks for the confirmation. :)
>>
>> @Stuart
>>
>> I've also tried both and they worked on my Windows 7.
>> But I'm using
>> - ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
>> - green_shoes (1.1.367)
>> - gtk2 (1.1.5 x86-mingw32)
>>
>> So, gtk2 is not the latest version. What version are you using?
>>
>> ashbb
>>
>
>

Re: [shoes] Removal of focus from objects

From:
J. Kaiden
Date:
2013-01-23 @ 11:56
hi all,

  @Stuart - both snippets also run just fine on my setup...  Ubuntu 12.04,
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux], green_shoes
(1.1.354)    -  so this is probably a platform issue as ashbb suggests.

  @ashbb - good to hear from you - i've been off the radar for a while :/
 thanks for the idea, but under red shoes it doesn't seem to work for me...
 i also tried tying the edit_box focus to a button click, and that doesn't
work under red either:

Shoes.app do
eb = edit_box
button("focus edit_box"){eb.focus}
end

  ...under green shoes, the edit_box has the focus when the window opens -
an interesting difference from red shoes where it does not.  also, this
snippet works for me under green, but not red:

Shoes.app do
eb = edit_box
lb = list_box items: ["a", "b", "c"]
button("focus edit_box"){eb.focus}
end


  - j


On Wed, Jan 23, 2013 at 11:43 AM, ashbb <ashbbb@gmail.com> wrote:

> @Seba
>
>
> > I've tried both and they work for me (Ubuntu 12.10, ruby 1.9, green
> > shoes).
> Wow, glad to hear that. Thanks for the confirmation. :)
>
> @Stuart
>
> I've also tried both and they worked on my Windows 7.
> But I'm using
> - ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
> - green_shoes (1.1.367)
> - gtk2 (1.1.5 x86-mingw32)
>
> So, gtk2 is not the latest version. What version are you using?
>
> ashbb
>

Re: [shoes] Removal of focus from objects

From:
ashbb
Date:
2013-01-23 @ 10:42
@J

> anyone got any ideas about this one?

Try out the following snippet.

Shoes.app do
  eb = edit_box
  timer(0.01){eb.focus}
end

You can focus on the edit_box after opening the window. ;-)

ashbb