windows & alerts...

Just starting out? Need help? Post your questions and find answers here.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

windows & alerts...

Post by Skipsy »

hello,

I am back to my recurent problem with windows events :cry: :cry:

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.
Beware of the man who has the solution before he understands the problem...
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: windows & alerts...

Post 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
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: windows & alerts...

Post 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().
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: windows & alerts...

Post 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. :wink:
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: windows & alerts...

Post 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. :wink:
There is also no image, but a InitSprite(), so i think, he has the problem with OpenWindowedScreen.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post 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... :?
Beware of the man who has the solution before he understands the problem...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post 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.
Beware of the man who has the solution before he understands the problem...
Post Reply