Event issue

Just starting out? Need help? Post your questions and find answers here.
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Event issue

Post by Kanati2 »

If I have the following code... Where I create a windowed screen...

Code: Select all

window = OpenWindow(#pb_any, 0,0, DesktopWidth(0), DesktopHeight(0), #PB_Window_BorderLess,"")

If window = 0
  End
EndIf     

screen = OpenWindowedScreen(WindowID(), 0, 0, DesktopWidth(0), DesktopHeight(0), 1, 0, 0)

If screen = 0 
  End
EndIf  
Why do I no longer get windows events using

Code: Select all

result = WaitWindowsEvent()
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

The following code works fine for me.

Code: Select all

ExamineDesktops()

window = OpenWindow(#PB_Any, 0,0, DesktopWidth(0), DesktopHeight(0), #PB_Window_BorderLess,"")

If window = 0
  End
EndIf     

InitSprite()

screen = OpenWindowedScreen(WindowID(), 0, 0, DesktopWidth(0), DesktopHeight(0), 1, 0, 0)

If screen = 0
  End
EndIf  

Repeat
  event = WaitWindowEvent()
  Debug event
Until event = #PB_Event_CloseWindow
I get a steady stream of events listed in debug. Alt-F4 results in a #PB_Event_Close_Window.

Do you get something different?

Out of curiosity, why don't you just use OpenScreen() ?
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Post by Kanati2 »

hrm... Yes I do but I also have InitKeyboard() and InitSprite() prior to that call.

I'll do a bit of experimenting here... Thanks for your test.
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Post by Kanati2 »

Ok... I'm not sure if it was the initkeyboard() stuff that was stopping it from working or the examinekeyboard... or... but anyway I am recieving events now.

Now I just need to figure out how to interpret the keyboard events... Which seem to be 256,257,258... But what key? That's the question. :)
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Kanati,

You might find this useful:
viewtopic.php?t=12352

WaitWindowEvent() does intercept some events in some circumstances, making them unavailable.

For a finer level of control with the events try using SetWindowCallback().

Theres useful api information in the beginners FAQ: viewtopic.php?t=4876&highlight=Win32api
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Post by Kanati2 »

Thanks. But it does look like I'm getting the info I need now. Thanks. :)
Post Reply