librelist archives

« back to archive

Window close event?

Window close event?

From:
Steve Klabnik
Date:
2010-12-19 @ 05:42
Hey guys-

Doing some Red Shoes source diving with wilkie this evening... it seems that
there's no way to capture the 'app is closing' event. Is this true? Or am I
overlooking something?

-Steve

Re: [shoes] Window close event?

From:
Devyn Cairns
Date:
2010-12-19 @ 20:01
What about Ruby's 'at_exit'? Don't know if it would work, but it's worth a
try.

On Sat, Dec 18, 2010 at 9:42 PM, Steve Klabnik <steve@steveklabnik.com>wrote:

> Hey guys-
>
> Doing some Red Shoes source diving with wilkie this evening... it seems
> that there's no way to capture the 'app is closing' event. Is this true? Or
> am I overlooking something?
>
> -Steve
>



-- 
    ~devyn

Re: [shoes] Window close event?

From:
ashbb
Date:
2010-12-19 @ 21:24
Hi Devyn and folks,

The at_exit method doesn't work in Shoes at least on Windows.
Use close instead of exit.
Look at this: https://github.com/shoes/shoes/issues/closed#issue/25

ashbb

Re: [shoes] Window close event?

From:
Zachary Scott
Date:
2010-12-19 @ 06:25
I was able to capture an alert in the finalization block, but haven't
gotten to updating that issue yet.

There is a light at the end of the tunnel tho! :D

On Sun, Dec 19, 2010 at 12:42 AM, Steve Klabnik <steve@steveklabnik.com> wrote:
> Hey guys-
> Doing some Red Shoes source diving with wilkie this evening... it seems that
> there's no way to capture the 'app is closing' event. Is this true? Or am I
> overlooking something?
> -Steve



-- 
Zachary Scott

Re: [shoes] Window close event?

From:
Cecil Coupe
Date:
2010-12-19 @ 07:43
Steve,

  I think you are correct. An external to Shoes GUI event like App
Closing has no handler unless the OS delivers a simulated ^X or ^Q or
fan-Q or as a keypress event (OSX used to do that for Carbon apps, if
memory serves, Windows might have done that too). Its similar to the
system tray feature requests - Shoes scripts are not aware of external
events and they don't have an api to be informed of them or gui manager
express the shoes script status.

  It kind of depends on what one thinks Shoes should be - quick and easy
or feature rich. I'd rather see the packager problems get fixed first in
Red Shoes for Windows and OSX before defining an external event hook and
cross platform API

  Still, a Shoes pseudo non gui widget with block syntax would be useful
to some.

Shoes.app do 
  stack .... flow....
  end
  
  on_system_event do |sysevent|
     case sysevent
     when 'minimized'
	Shoes.app::update_tray "#{@player_status[@current]}"
        @game = 'suspend'
     when 'up_front'
	Shoes.app::clear_tray
	@game = 'full_speed'
     when 'really_quit'
       #save stuff - logout or reboot, it can't be canceled
     when disk_removed
	alert "You Bastard"l exit;
  end # system events
end # Shoes.App

Sorry for mixing up my python and ruby syntax but is just thought
experiment. Casual Shoes users wouldn't have to create the
on_system_event handler - backwards compatible

What the names of the events are or the name of the event handler
doesn't matter. Separate On_minimize and on_up_top and on_really_quit
handlers feels better to me, stylistically. YMMV.

But first the packager bugs. From linux, I can't create a working
Windows Net-Install.exe Can't create a working (net install) for OSX
either. Can't package a script with a full install of OSX Shoes either.
  


On Sun, 2010-12-19 at 00:42 -0500, Steve Klabnik wrote:
> Hey guys-
> 
> 
> Doing some Red Shoes source diving with wilkie this evening... it
> seems that there's no way to capture the 'app is closing' event. Is
> this true? Or am I overlooking something?
> 
> 
> -Steve

Re: [shoes] Window close event?

From:
Zachary Scott
Date:
2010-12-19 @ 10:12
I don't know about all of that, but I was able to successfully use
#finish with this example app: https://gist.github.com/747239

Please also note this is the issue relating to this bug:
https://github.com/hacketyhack/hacketyhack/issues/#issue/51

Thanks and test this out for yourselves please

On Sun, Dec 19, 2010 at 2:43 AM, Cecil Coupe <ccoupe@cableone.net> wrote:
> Steve,
>
>  I think you are correct. An external to Shoes GUI event like App
> Closing has no handler unless the OS delivers a simulated ^X or ^Q or
> fan-Q or as a keypress event (OSX used to do that for Carbon apps, if
> memory serves, Windows might have done that too). Its similar to the
> system tray feature requests - Shoes scripts are not aware of external
> events and they don't have an api to be informed of them or gui manager
> express the shoes script status.
>
>  It kind of depends on what one thinks Shoes should be - quick and easy
> or feature rich. I'd rather see the packager problems get fixed first in
> Red Shoes for Windows and OSX before defining an external event hook and
> cross platform API
>
>  Still, a Shoes pseudo non gui widget with block syntax would be useful
> to some.
>
> Shoes.app do
>  stack .... flow....
>  end
>
>  on_system_event do |sysevent|
>     case sysevent
>     when 'minimized'
>        Shoes.app::update_tray "#{@player_status[@current]}"
>        @game = 'suspend'
>     when 'up_front'
>        Shoes.app::clear_tray
>        @game = 'full_speed'
>     when 'really_quit'
>       #save stuff - logout or reboot, it can't be canceled
>     when disk_removed
>        alert "You Bastard"l exit;
>  end # system events
> end # Shoes.App
>
> Sorry for mixing up my python and ruby syntax but is just thought
> experiment. Casual Shoes users wouldn't have to create the
> on_system_event handler - backwards compatible
>
> What the names of the events are or the name of the event handler
> doesn't matter. Separate On_minimize and on_up_top and on_really_quit
> handlers feels better to me, stylistically. YMMV.
>
> But first the packager bugs. From linux, I can't create a working
> Windows Net-Install.exe Can't create a working (net install) for OSX
> either. Can't package a script with a full install of OSX Shoes either.
>
>
>
> On Sun, 2010-12-19 at 00:42 -0500, Steve Klabnik wrote:
>> Hey guys-
>>
>>
>> Doing some Red Shoes source diving with wilkie this evening... it
>> seems that there's no way to capture the 'app is closing' event. Is
>> this true? Or am I overlooking something?
>>
>>
>> -Steve
>
>
>



-- 
Zachary Scott

Re: [shoes] Window close event?

From:
ashbb
Date:
2010-12-19 @ 14:33
Hi Zak,

Cool! https://gist.github.com/747239 worked with Shoes 3 on my Windows 7.

ashbb

Re: [shoes] Window close event?

From:
Steve Klabnik
Date:
2010-12-19 @ 18:07
The gist doesn't work on the Mac. I get no alert.