[ résolu] fenetre avec échappe

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

[ résolu] fenetre avec échappe

Message par venom »

bonjour,

voila je cherche le moyen de fermer une fenetre normale avec le boutton échappe du clavier mais si je ne suis pas dans un screen je n'arrive pas a utilisé le clavier donc je souhaiterais saoir si c'est possible :wink: .

Code : Tout sélectionner

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

  If OpenWindow(#Window_0, 0, 0, 600, 300, "test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateGadgetList(WindowID(#Window_0))
      
    EndIf
  EndIf

  Repeat
   EventID = WaitWindowEvent()
    If EventID = #PB_Event_Gadget
      Select EventGadget()

      EndSelect
    EndIf
  Until EventID = #PB_Event_CloseWindow

merci d'avance.


@++[/code]
Dernière modification par venom le mar. 19/juin/2007 5:34, modifié 1 fois.
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Cls
Messages : 620
Inscription : mer. 22/juin/2005 8:51
Localisation : Nantes

Message par Cls »

Code : Tout sélectionner

AddKeyboardShortcut(#Fenetre, Raccourci, Event)
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

ah ok :wink: .

faut passer par menu est non gadget :oops: .

autant pour moi et merci Cls :wink: .

pour ceux qu'ils veulent voir le code modifier :wink: .

Code : Tout sélectionner

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

  If OpenWindow(#Window_0, 0, 0, 600, 300, "test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateMenu(0,WindowID(#Window_0)) ;<--------------- on crée un menu est non un gadget ;)
     AddKeyboardShortcut(#Window_0, #PB_Shortcut_Escape, 15) ;<--------  on choisis son raccourci et le numero de la case plus bas
     
    EndIf
  EndIf

  Repeat
   EventID = WaitWindowEvent()
    If EventID = #PB_Event_Menu
      Select EventMenu()

      Case 15 ;<--------------- la Case en question
       End ;<----------- on quitte le programme


      EndSelect
    EndIf
  Until EventID = #PB_Event_CloseWindow

@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Cls
Messages : 620
Inscription : mer. 22/juin/2005 8:51
Localisation : Nantes

Message par Cls »

Oui j'ai été bref, je n'avais pas beaucoup de temps :wink:
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

Oui j'ai été bref, je n'avais pas beaucoup de temps Wink
c'est pas grave le résultat est la :wink: .


@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Répondre