Page 1 of 1

Event issue

Posted: Wed Jul 06, 2005 8:55 pm
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()

Posted: Wed Jul 06, 2005 9:23 pm
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() ?

Posted: Wed Jul 06, 2005 10:19 pm
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.

Posted: Wed Jul 06, 2005 10:51 pm
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. :)

Posted: Thu Jul 07, 2005 12:01 am
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

Posted: Thu Jul 07, 2005 5:14 am
by Kanati2
Thanks. But it does look like I'm getting the info I need now. Thanks. :)