Trouble closing..

Just starting out? Need help? Post your questions and find answers here.
oToom
User
User
Posts: 54
Joined: Sat May 03, 2008 5:38 pm

Trouble closing..

Post by oToom »

Okay stupid questions,

This closes (i dont get to see the very small box.

Code: Select all

; PureBasic Visual Designer v3.95 build 1485 (PB4Code)


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration


Open_Window_0()
OpenWindow(#Window_0, 702, 419, 5, 5, "",  #PB_Window_BorderLess | #PB_Window_ScreenCentered | #PB_Window_WindowCentered )
    CreateGadgetList(WindowID(#Window_0))
            BackColor(black)

AddKeyboardShortcut(#Window_0, #PB_Shortcut_Escape, #PB_Event_CloseWindow)

Repeat
  Event = WaitWindowEvent()
 
  Select Event

  
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
Help appreviated, please and thanks!
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Trouble closing..

Post by rsts »

The particular code you provided won't even run, so it's not surprising you don't see anything.

cheers
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Trouble closing..

Post by netmaestro »

Code: Select all

Enumeration
  #Window_0
EndEnumeration

OpenWindow(#Window_0, 702, 419, 5, 5, "",  #PB_Window_BorderLess | #PB_Window_ScreenCentered | #PB_Window_WindowCentered )
SetWindowColor(#window_0, #Black)

AddKeyboardShortcut(#Window_0, #PB_Shortcut_Escape, 1)

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Menu 
      If EventMenu()=1
        Break
      EndIf
  EndSelect
ForEver
This works, but bear in mind that if the tiny window doesn't have the keyboard focus, the ESC key won't do anything. Best replace it with something else like a hotkey or perhaps GetAsyncKeyState.
BERESHEIT
oToom
User
User
Posts: 54
Joined: Sat May 03, 2008 5:38 pm

Re: Trouble closing..

Post by oToom »

Thanks rsts for letting me know it wouldn't work.

Also thanks, netmaestro for some working code. Greatly appreciated :D
Post Reply