[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

FXRuby - handling Alt+F4

Chris Morris

2/7/2005 6:17:00 PM

I'm trying to properly write a way to capture an Alt+F4 keystroke, and
I'm not finding the right constant for the Alt key. Here's what I've
currently got, and it works, but obviously isn't the 'correct' way to
&& out the Alt key from the evt.state:

if (evt.state == 24) && (evt.code == KEY_F4)
exit
else
...
end


--
Chris
http:/...


5 Answers

Stephan Kämper

2/7/2005 7:21:00 PM

0

Chris Morris wrote:
> I'm trying to properly write a way to capture an Alt+F4 keystroke, and
> I'm not finding the right constant for the Alt key. Here's what I've
> currently got, and it works, but obviously isn't the 'correct' way to
> && out the Alt key from the evt.state:
>
> if (evt.state == 24) && (evt.code == KEY_F4)
> exit
> else
> ...
> end
>

I did it by writing this:

menu_bar = FXMenubar.new( self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X )

file_menu = FXMenuPane.new( self )
FXMenuCommand.new( fileMenu, "&Quit\tALT-F4", nil, app, FXApp::ID_QUIT )

I'm sure there are ways to close an application without having a menu
bar. Lyle?

Happy rubying

Stephan

Lyle Johnson

2/7/2005 7:32:00 PM

0

On Tue, 8 Feb 2005 04:25:12 +0900, Stephan Kämper

> I'm sure there are ways to close an application without having a menu
> bar. Lyle?

I haven't tried this, but what happens if you just add the accelerator
directly to the main window's accelerator table, i.e.

mainWindow.addAccel(fxparseAccel("Alt+F4"), app, FXApp::ID_QUIT))

Hope this helps,

Lyle



Lyle Johnson

2/17/2005 2:16:00 PM

0

On Sun, 13 Feb 2005 21:23:15 -0600, Chris Morris <the.chrismo@gmail.com> wrote:

> fxparseAccel failed -- not in scope or what-have-you -- what requires
> do I need to be able to use this? (Or is it a version problem? Not
> sure what version I'm using).

I think you must be using FXRuby 1.0, and I was using the FXRuby 1.2
"spelling". Try "fxparseaccel" (with all lowercase letters) instead.


Mariusz Marszalkowski

3/31/2013 2:19:00 PM

0

W dniu niedziela, 31 marca 2013 16:05:48 UTC+2 uzytkownik firr kenobi napisal:

> raczej mam na mysli czytanie netu niz z papieru, nie wydaje mi sie aby ktos
> wogole mogl 'malo czytac' bez przerwy trzeba sprawdzac jakies api albo kwestie
> odnoszace sie do jakichs problemów itd w necie.. no ale nie wiem

To zalezy. O tym co teraz robie nie moge poczytac, wartosciowe informacje
nie wyszly poza zaufane grono. Poza tym kazdy programista ma swoja klase
aplikacji ktore moze zrobic "z zamknietymi oczyma", bez douczania sie. Gdzies
w tematyke ktora poruszyles wplata sie umiejetnosc uczenia sie na pamiec. Sa
tacy, co potrafia nawet bez dokumentacji pracowac, bo znaja ja na pamiec - ja
do takich nie naleze.

Pozdrawiam

Mariusz Marszalkowski

3/31/2013 2:38:00 PM

0

W dniu niedziela, 31 marca 2013 16:05:48 UTC+2 uzytkownik firr kenobi napisal:
> raczej mam na mysli czytanie netu niz z papieru, nie wydaje mi sie aby ktos
> wogole mogl 'malo czytac' bez przerwy trzeba sprawdzac jakies api albo kwestie
> odnoszace sie do jakichs problemów itd w necie.. no ale nie wiem
Sorry ze odpisuje na raty. Odnosnie czytania, to bym poczytal jakas
"monografie" na temat aproksymacji przy pomocy linii lamanej. W goolgach
nie udalo mi sie znalezc nic ciekawego, moze ktos ma jakies ciekawe
opracowanie?
Pozdrawiam