Page 1 of 1
					
				windows & alerts...
				Posted: Mon Sep 15, 2003 6:37 pm
				by Skipsy
				hello,
I am back to my recurent problem with windows events  
 
   
 
With the following code the application is supposed to beep at each
window event.
Could some explain why it is not beeping when I am moving that stupid
alert ????
Code: Select all
InitSprite()
OpenWindow(1, 0, 200, 400, 400, #PB_Window_MinimizeGadget, "test" )
QUITTE = 0
While QUITTE = 0
  
  If GetAsyncKeyState_($1b)                               ; SP bar
    QUITTE = 1
  EndIf
  
  EVT_WIND.l = WindowEvent()
  Delay (1)
  If EVT_WIND > 0
    beep_(100,10)
    
    Select EVT_WIND
      
    Case #PB_Event_CloseWindow
      MessageRequester("Test", "Bla bla bla", 0)
      
  EndSelect
      
  EndIf
Wend
There is a backgrnd picture I have to refresh is the alert has moved.
Is there any way to make the application window detects the alert has moved ?
Thks folks.
 
			
					
				
				Posted: Mon Sep 15, 2003 6:47 pm
				by freak
				MessageRequester() stops the program execution compleetly while
it is open. You need to create your own MessageRequester like Window
to work around that.
Timo
			 
			
					
				Re: windows & alerts...
				Posted: Tue Sep 16, 2003 2:46 am
				by PB
				> There is a backgrnd picture I have to refresh is the alert has moved.
Windows itself should refresh the picture when the MessageRequester
is moved.  Sounds like a graphics card driver issue to me... do you have
the latest drivers installed?  If so, perhaps you can give us some working
code to test how it looks on our systems?
Alternatively, see if my tip at this URL helps:
viewtopic.php?t=4779 
			
					
				Re: windows & alerts...
				Posted: Tue Sep 16, 2003 9:42 am
				by GPI
				[quote="PB"]> There is a backgrnd picture I have to refresh is the alert has moved.
Windows itself should refresh the picture when the MessageRequester
is moved.  Sounds like a graphics card driver issue to me... do you have
the latest drivers installed?  [quote]
Yes, Windows repaint gadget, but no openWindowscreen().
			 
			
					
				Re: windows & alerts...
				Posted: Tue Sep 16, 2003 10:54 am
				by PB
				> Yes, Windows repaint gadget, but no openWindowscreen()
But the original poster used OpenWindow, not OpenWindowedScreen,
in his example, which is therefore what I based my reply on.   

 
			
					
				Re: windows & alerts...
				Posted: Tue Sep 16, 2003 11:30 am
				by GPI
				PB wrote:> Yes, Windows repaint gadget, but no openWindowscreen()
But the original poster used OpenWindow, not OpenWindowedScreen,
in his example, which is therefore what I based my reply on.   

 
There is also no image, but a InitSprite(), so i think, he has the problem with OpenWindowedScreen.
 
			
					
				
				Posted: Tue Sep 16, 2003 12:22 pm
				by Skipsy
				Sorry for the delay... I have some trouble with windows security hole at
my job.
Well, I can understand there is no events on a WindowedScreen
but in my test (the code I have posted), there is no windowed screen.
It is a very basic window. I don't want any pict to be diplayed here, just
a BEEP when I move the alert box above it.
I did a test with some gadgets in the window. Gadgets are not erased
when I move the Alert box but the WindowEvent does not detect any
event (no beep).
I'll probably have to manage my own alert window... 

 
			
					
				
				Posted: Tue Sep 16, 2003 1:38 pm
				by PB
				Try this:
Code: Select all
Procedure MyWindowCallback(WindowID,Message,wParam,lParam) 
  Result=#PB_ProcessPureBasicEvents
  If message=#WM_PAINT
    beep_(100,10)
  EndIf
  ProcedureReturn Result 
EndProcedure
OpenWindow(1, 0, 200, 400, 400, #PB_Window_MinimizeGadget, "test" ) 
SetWindowCallback(@MyWindowCallback())
QUITTE = 0 
While QUITTE = 0 
  
  If GetAsyncKeyState_($1b)                               ; SP bar 
    QUITTE = 1 
  EndIf 
  
  EVT_WIND.l = WindowEvent() 
  Delay (1) 
  If EVT_WIND > 0 
    beep_(100,10) 
    
    Select EVT_WIND 
      
    Case #PB_Event_CloseWindow 
      MessageRequester("Test", "Bla bla bla", 0) 
      
  EndSelect 
      
  EndIf 
Wend
 
			
					
				
				Posted: Tue Sep 16, 2003 3:01 pm
				by Skipsy
				This is brilliant !!!
Even if I am not comfortable with SetWindowCallback.
If I understand, SetWindowCallback(@MyWindowCallback()) sends
EVERY WINDOW EVENTS to the procedure MyWindowCallback.
( Here I am wondering why WindowEvent() does not the same )
Then... I don't understand the reason of
"Result=#PB_ProcessPureBasicEvents" as this variable is not modified
inside the procedure....
Thks a lot.